poppler/XRef.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
New commits: commit b21b041f7948680c03109f0c404400a9dbc4544c Author: Albert Astals Cid <aa...@kde.org> Date: Tue Apr 25 19:48:24 2017 +0200 Fix memory leak when reconstructing broken files Need to free the catalog variable if we're going to fetch over it again Bug #100776 diff --git a/poppler/XRef.cc b/poppler/XRef.cc index c141bbfe..6ea0fbb6 100644 --- a/poppler/XRef.cc +++ b/poppler/XRef.cc @@ -1144,13 +1144,16 @@ GBool XRef::okToAssemble(GBool ignoreOwnerPW) { } Object *XRef::getCatalog(Object *catalog) { - Object *obj = fetch(rootNum, rootGen, catalog); - if (obj->isDict()) { - return obj; + fetch(rootNum, rootGen, catalog); + if (catalog->isDict()) { + return catalog; } GBool wasReconstructed = false; - GBool ok = constructXRef(&wasReconstructed, gTrue); - return (ok) ? fetch(rootNum, rootGen, catalog) : obj; + if (constructXRef(&wasReconstructed, gTrue)) { + catalog->free(); + fetch(rootNum, rootGen, catalog); + } + return catalog; } Object *XRef::fetch(int num, int gen, Object *obj, int recursion) { _______________________________________________ poppler mailing list poppler@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/poppler