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.
--
regards
Axel
--- PDFDoc.cc_org 2010-12-27 21:44:28.000000000 +0100
+++ PDFDoc.cc 2011-05-29 12:56:30.009243985 +0200
@@ -991,6 +991,6 @@
if (incrUpdate) {
+ xref->getTrailerDict()->getDict()->lookup("ID", &obj4);
//only update the second part of the array
- if(xref->getTrailerDict()->getDict()->lookup("ID", &obj4) != NULL) {
if (!obj4.isArray()) {
error(-1, "PDFDoc::writeTrailer original file's ID entry isn't an array. Trying to continue");
@@ -1003,5 +1003,5 @@
trailerDict->set("ID", &obj2);
}
- }
+ obj4.free();
} else {
//new file => same values for the two identifiers
_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler