[poppler] glib/poppler-document.cc
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Aug 19 16:41:54 UTC 2022
glib/poppler-document.cc | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
New commits:
commit 99889f51e95169c4946f3bbd74adb317bf3b64a9
Author: Albert Astals Cid <aacid at kde.org>
Date: Fri Aug 19 18:38:06 2022 +0200
glib: Fix two potential memory leaks in poppler_document_create_dests_tree
diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index 7796f5a3..ae9cb5fb 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -1050,7 +1050,6 @@ GTree *poppler_document_create_dests_tree(PopplerDocument *document)
Catalog *catalog;
PopplerDest *dest;
int i;
- gchar *key;
g_return_val_if_fail(POPPLER_IS_DOCUMENT(document), nullptr);
@@ -1067,9 +1066,9 @@ GTree *poppler_document_create_dests_tree(PopplerDocument *document)
// The names of name-dict cannot contain \0,
// so we can use strlen().
auto name = catalog->getDestsName(i);
- key = poppler_named_dest_from_bytestring(reinterpret_cast<const guint8 *>(name), strlen(name));
std::unique_ptr<LinkDest> link_dest = catalog->getDestsDest(i);
if (link_dest) {
+ gchar *key = poppler_named_dest_from_bytestring(reinterpret_cast<const guint8 *>(name), strlen(name));
dest = _poppler_dest_new_goto(document, link_dest.get());
g_tree_insert(tree, key, dest);
}
@@ -1079,9 +1078,9 @@ GTree *poppler_document_create_dests_tree(PopplerDocument *document)
const int nDestsNameTree = catalog->numDestNameTree();
for (i = 0; i < nDestsNameTree; ++i) {
auto name = catalog->getDestNameTreeName(i);
- key = poppler_named_dest_from_bytestring(reinterpret_cast<const guint8 *>(name->c_str()), name->getLength());
std::unique_ptr<LinkDest> link_dest = catalog->getDestNameTreeDest(i);
if (link_dest) {
+ gchar *key = poppler_named_dest_from_bytestring(reinterpret_cast<const guint8 *>(name->c_str()), name->getLength());
dest = _poppler_dest_new_goto(document, link_dest.get());
g_tree_insert(tree, key, dest);
}
More information about the poppler
mailing list