[poppler] glib/poppler-document.cc
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Dec 7 23:20:04 UTC 2021
glib/poppler-document.cc | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
New commits:
commit ccfeabf5c7fe91469a4cdbfe1e533e4bd39963e6
Author: Christian Persch <chpe at src.gnome.org>
Date: Tue Dec 7 17:55:28 2021 +0100
glib: Plug some mem leaks
This code leaked a GooString each time it was called.
==1018012== 56 (32 direct, 24 indirect) bytes in 1 blocks are definitely lost in loss record 11,042 of 19,178
==1018012== at 0x4841FF5: operator new(unsigned long) (vg_replace_malloc.c:422)
==1018012== by 0x1EFE8DA5: copy (GooString.h:104)
==1018012== by 0x1EFE8DA5: Object::copy() const (Object.cc:52)
==1018012== by 0x1EFE8EE8: Object::fetch(XRef*, int) const (Object.cc:78)
==1018012== by 0x1EF6C0C7: Dict::lookup(char const*, int) const (Dict.cc:167)
==1018012== by 0x1EFF5592: dictLookup (Object.h:622)
==1018012== by 0x1EFF5592: PDFDoc::getDocInfoStringEntry(char const*) (PDFDoc.cc:779)
==1018012== by 0x1EA00E71: getDocInfoCreatDate (PDFDoc.h:277)
==1018012== by 0x1EA00E71: poppler_document_get_creation_date_time (poppler-document.cc:1596)
diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index fd2c7fbc..7a000398 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -1602,12 +1602,12 @@ GDateTime *poppler_document_get_creation_date_time(PopplerDocument *document)
{
g_return_val_if_fail(POPPLER_IS_DOCUMENT(document), nullptr);
- GooString *str = document->doc->getDocInfoCreatDate();
+ std::unique_ptr<GooString> str { document->doc->getDocInfoCreatDate() };
if (!str)
return nullptr;
- return _poppler_convert_pdf_date_to_date_time(str);
+ return _poppler_convert_pdf_date_to_date_time(str.get());
}
/**
@@ -1690,12 +1690,12 @@ GDateTime *poppler_document_get_modification_date_time(PopplerDocument *document
{
g_return_val_if_fail(POPPLER_IS_DOCUMENT(document), nullptr);
- GooString *str = document->doc->getDocInfoModDate();
+ std::unique_ptr<GooString> str { document->doc->getDocInfoModDate() };
if (!str)
return nullptr;
- return _poppler_convert_pdf_date_to_date_time(str);
+ return _poppler_convert_pdf_date_to_date_time(str.get());
}
/**
More information about the poppler
mailing list