[poppler] poppler Digest, Vol 75, Issue 26

Axel Strübing axel.struebing at freenet.de
Sun May 29 04:10:56 PDT 2011

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.

As always, I could be wrong pand any comments are welcome.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PDFDoc.patch
Type: text/x-patch
Size: 627 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20110529/0fdc658d/attachment.bin>

More information about the poppler mailing list