[poppler] poppler Digest, Vol 75, Issue 26

Albert Astals Cid aacid at kde.org
Sun May 29 08:14:53 PDT 2011


A Sunday, May 29, 2011, Axel Strübing va escriure:
> Dear all,
> 
> > A Saturday, May 28, 2011, Axel Strübing va escriure:
> > > Dear popplers
> > > 
> > > there seems to be a glitch in PDFDoc::writeTrailer.
> > > 
> > > For incremental updates
> > > if(xref->getTrailerDict()->getDict()->lookup("ID", &obj4) != NULL) {
> > > is checked but this call never returns NULL but a pointer to Object
> > > (the Object being the NullObject or whatever)
> > > 
> > > IMHO the correct line would be:
> > > if( ! xref->getTrailerDict()->getDict()->lookup("ID", &obj4)->isNull()
> > > ) {
> > > 
> > > This saved me the observed warning.
> > > I attach a the patch to PDFDoc.cc.
> > 
> > Yeah the check for NULL is not needed, but yours is not needed afterwars
> > either since the next line checks for isArray or not, so i'll just kill
> > that NULL check.
> > 
> > Albert
> 
> Thank you for the correction.
> If i kill that check there is that little warning if the doc had not had an
> ID entry in the first place but everything will be okay.
> 
> I noticed that we should free the used object because otherwise a leak
> occurs. If I change the code as in the attached patch, no more suspicious
> memory will be reported by valgrind.
> The patch kills the superfluidious check - Albert pointed out -  and adds
> the line freeing up the memory for obj4.

Yeah, i suspected that when i had a look at the code.

Albert

> 
> As always, I could be wrong pand any comments are welcome.
> 
> --
> regards
> Axel


More information about the poppler mailing list