[poppler] poppler/Parser.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Mon Jul 31 22:54:12 UTC 2017


 poppler/Parser.cc |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 19eda068ae1866e4f46efc9534b34779007fdc16
Author: Albert Astals Cid <aacid at kde.org>
Date:   Tue Aug 1 00:53:52 2017 +0200

    Fix memory leak on corner case condition

diff --git a/poppler/Parser.cc b/poppler/Parser.cc
index 07e220f4..4b399028 100644
--- a/poppler/Parser.cc
+++ b/poppler/Parser.cc
@@ -69,7 +69,6 @@ Object Parser::getObj(GBool simpleOnly,
 		       int objNum, int objGen, int recursion,
 		       GBool strict) {
   Object obj;
-  char *key;
   Stream *str;
   DecryptStream *decrypt;
   GooString *s, *s2;
@@ -111,7 +110,7 @@ Object Parser::getObj(GBool simpleOnly,
 	shift();
       } else {
 	// buf1 might go away in shift(), so construct the key
-	key = copyString(buf1.getName());
+	char *key = copyString(buf1.getName());
 	shift();
 	if (buf1.isEOF() || buf1.isError()) {
 	  gfree(key);
@@ -120,6 +119,7 @@ Object Parser::getObj(GBool simpleOnly,
 	}
 	Object obj2 = getObj(gFalse, fileKey, encAlgorithm, keyLength, objNum, objGen, recursion + 1);
 	if (unlikely(obj2.isError() && recursion + 1 >= recursionLimit)) {
+	  gfree(key);
 	  break;
 	}
 	obj.dictAdd(key, std::move(obj2));


More information about the poppler mailing list