diff options
author | Christian Persch <chpe@src.gnome.org> | 2021-12-07 17:55:28 +0100 |
---|---|---|
committer | Albert Astals Cid <tsdgeos@yahoo.es> | 2021-12-07 23:13:50 +0000 |
commit | ccfeabf5c7fe91469a4cdbfe1e533e4bd39963e6 (patch) | |
tree | ef82681fb24a7c1f7f7fdf25724344fc23e104b1 | |
parent | 202c2abec530919d19048406cb1605c75c643019 (diff) |
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)
-rw-r--r-- | glib/poppler-document.cc | 8 |
1 files changed, 4 insertions, 4 deletions
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()); } /** |