[poppler] poppler/Dict.cc
Albert Astals Cid
aacid at kemper.freedesktop.org
Tue Oct 7 14:55:53 PDT 2014
poppler/Dict.cc | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
New commits:
commit 745f1241bf903969e50f0e1139641e389a9c331f
Author: Scott West <scott.gregory.west at gmail.com>
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 <krh at redhat.com>
// Copyright (C) 2006 Krzysztof Kowalczyk <kkowalczyk at gmail.com>
// Copyright (C) 2007-2008 Julien Rebetez <julienr at svn.gnome.org>
-// Copyright (C) 2008, 2010, 2013 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2008, 2010, 2013, 2014 Albert Astals Cid <aacid at kde.org>
// Copyright (C) 2010 PaweÅ Wiejacha <pawel.wiejacha at gmail.com>
// Copyright (C) 2012 Fabio D'Urso <fabiodurso at hotmail.it>
// Copyright (C) 2013 Thomas Freitag <Thomas.Freitag at alfa.de>
+// Copyright (C) 2014 Scott West <scott.gregory.west at gmail.com>
//
// 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
More information about the poppler
mailing list