[Poppler-bugs] [Bug 90066] pdfunite: embedded files discarded during merge

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Apr 20 19:24:31 PDT 2015


https://bugs.freedesktop.org/show_bug.cgi?id=90066

--- Comment #7 from Jason Crain <jason at aquaticape.us> ---
Comment on attachment 115174
  --> https://bugs.freedesktop.org/attachment.cgi?id=115174
insert embedded files in result pdf

Review of attachment 115174:
-----------------------------------------------------------------

::: utils/pdfunite.cc
@@ +42,5 @@
> +  Object srcNameArray;
> +  mergeNameTree->lookup("Names", &mergeNameArray);
> +  srcNameTree->lookup("Names", &srcNameArray);
> +  if (mergeNameArray.isArray() && srcNameArray.isArray()) {
> +    Object *newNameArray = new Object();

You are leaking newNameArray in a couple places.  srcNameTree->set/add will
make a shallow copy so you shouldn't call newNameArray->free, but you still
need to delete the Object.  Or use a stack variable.

@@ +61,5 @@
> +            if (mkey.getString()->cmp(key.getString()) < 0) {
> +              Object *newKey = new Object();
> +	      newKey->initString(new GooString(mkey.getString()->getCString()));
> +              newNameArray->arrayAdd(newKey);
> +              Object *newValue = new Object();

same, newKey and newValue are being leaked in a few places.  Object::arrayAdd
makes a shallow copy.

@@ +249,5 @@
>      }
> +    catDict->lookup("Names", &names);
> +    if (!names.isNull() && names.isDict()) {
> +      docs[0]->markPageObjects(names.getDict(), yRef, countRef, 0, refPage->num, refPage->num);
> +    }

You are processing the first document twice, first here and again below.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/poppler-bugs/attachments/20150421/2ee14261/attachment.html>


More information about the Poppler-bugs mailing list