[poppler] [PATCH] Memory leaks

Carlos Garcia Campos carlosgc at gnome.org
Mon May 8 11:40:32 PDT 2006


El lun, 08-05-2006 a las 19:56 +0200, Albert Astals Cid escribió:
> A Dilluns 08 Maig 2006 19:11, Carlos Garcia Campos va escriure:
> > Hi all,
> Hi
> 
> > I've been playing with valgrind for a while with evince and I've caught
> > several leaks in poppler.
> >
> > Here is a patch that fixes some leaks:
> >
> > http://carlosgc.linups.org/files/poppler-memleaks.diff
> 
> i omit the glib patches as there's better people to comment.
> 
> i'd say Catalog.cc patch is wrong, if you delete the Cstring of a GooString 
> the GooString ends up with the inside data dead as what getCString returns is 
> not a copy of the data is the data itself.

it isn't a GooString but a UGooString which returns a new allocated
string. 

char *UGooString::getCString() const
{
  char *res = new char[length + 1];
  for (int i = 0; i < length; i++) res[i] = s[i];
  res[length] = '\0';
  return res;
}

> in PDFDoc.cc is there really any possibility of reaching setup() with xref not 
> beign NULL?

I'm not sure about it, I think I got these errors in valgrind because of
an evince bug, so maybe we can avoid this part of the patch.

> Also i disagree we should refcount GlobalParams from within the lib, because 
> who creates now the globalparams now? Not the lib, but the lib decides to 
> delete globaparams when it thinks its no more needed? Nahhh, bad idea.

we are creating and freeing GlobalParams in glib/poppler-document.cc.
Without the patch we are allocating a new GlobalParams object for each
document we load and leaking the previous object. 

> poppler/TextOutputDev.cc is for krh.
> 
> So no patch i have enough karma/mood to commit ;-)
> 
> Albert
> 
> 		

-- 
Carlos Garcia Campos (KaL)
   elkalmail at yahoo.es
   carlosgc at gnome.org
   http://carlosgc.linups.org
PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada
	digitalmente
Url : http://lists.freedesktop.org/archives/poppler/attachments/20060508/18ba7bba/attachment.pgp


More information about the poppler mailing list