poppler/Dict.cc |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 745f1241bf903969e50f0e1139641e389a9c331f
Author: Scott West <[email protected]>
Date:   Tue Oct 7 23:54:52 2014 +0200

    Fix memory leak in Dict.remove.
    
    The entry was previously just overwritten now it is freed
    
    Small fixes by Albert oo
    
    Bug #84607

diff --git a/poppler/Dict.cc b/poppler/Dict.cc
index 4cf42dc..c2a94f4 100644
--- a/poppler/Dict.cc
+++ b/poppler/Dict.cc
@@ -16,10 +16,11 @@
 // Copyright (C) 2005 Kristian Høgsberg <[email protected]>
 // Copyright (C) 2006 Krzysztof Kowalczyk <[email protected]>
 // Copyright (C) 2007-2008 Julien Rebetez <[email protected]>
-// Copyright (C) 2008, 2010, 2013 Albert Astals Cid <[email protected]>
+// Copyright (C) 2008, 2010, 2013, 2014 Albert Astals Cid <[email protected]>
 // Copyright (C) 2010 Paweł Wiejacha <[email protected]>
 // Copyright (C) 2012 Fabio D'Urso <[email protected]>
 // Copyright (C) 2013 Thomas Freitag <[email protected]>
+// Copyright (C) 2014 Scott West <[email protected]>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -198,6 +199,8 @@ void Dict::remove(const char *key) {
     const int pos = binarySearch(key, entries, length);
     if (pos != -1) {
       length -= 1;
+      gfree(entries[pos].key);
+      entries[pos].val.free();
       if (pos != length) {
         memmove(&entries[pos], &entries[pos + 1], (length - pos) * 
sizeof(DictEntry));
       }
@@ -220,6 +223,8 @@ void Dict::remove(const char *key) {
       return;
     }
     //replace the deleted entry with the last entry
+    gfree(entries[i].key);
+    entries[i].val.free();
     length -= 1;
     tmp = entries[length];
     if (i!=length) //don't copy the last entry if it is deleted 
_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to