Bug 9638 - Memory leak in poppler-document
Summary: Memory leak in poppler-document
Status: RESOLVED FIXED
Alias: None
Product: poppler
Classification: Unclassified
Component: glib frontend (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: high normal
Assignee: poppler-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-13 09:05 UTC by Carlos Garcia Campos
Modified: 2007-01-28 07:37 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Patch (1.44 KB, patch)
2007-01-13 09:08 UTC, Carlos Garcia Campos
Details | Splinter Review
Updated patch (1.66 KB, patch)
2007-01-25 02:57 UTC, Carlos Garcia Campos
Details | Splinter Review

Description Carlos Garcia Campos 2007-01-13 09:05:28 UTC
struct tm *time is leaked in info_dict_get_date()

==5593== 88 bytes in 2 blocks are definitely lost in loss record 170 of 305
==5593==    at 0x40206D5: calloc (vg_replace_malloc.c:279)
==5593==    by 0x51EEF5D: g_malloc0 (gmem.c:150)
==5593==    by 0x45F6D44: info_dict_get_date(Dict*, char const*, _GValue*)
(poppler-document.cc:519)
==5593==    by 0x45F7B7E: poppler_document_get_property(_GObject*, unsigned,
_GValue*, _GParamSpec*) (poppler-document.cc:649)
==5593==    by 0x518552E: g_object_get_valist (gobject.c:656)
==5593==    by 0x5185775: g_object_get (gobject.c:1219)
Comment 1 Carlos Garcia Campos 2007-01-13 09:08:19 UTC
Created attachment 8391 [details] [review]
Patch

There is no reason why time had to be a pointer, so this patch uses directly a
struct tm instead of a pointer which fixes the leak.
Comment 2 Carlos Garcia Campos 2007-01-25 02:57:25 UTC
Created attachment 8500 [details] [review]
Updated patch

I've found another memleak in poppler-document:

==12925== 278 bytes in 15 blocks are definitely lost in loss record 168 of 333
==12925==    at 0x4021396: malloc (vg_replace_malloc.c:149)
==12925==    by 0x51EFFF5: g_malloc (gmem.c:131)
==12925==    by 0x5203448: g_strdup (gstrfuncs.c:91)
==12925==    by 0x51D36EB: g_filename_from_uri (gconvert.c:1797)
==12925==    by 0x45F61CF: poppler_document_save (poppler-document.cc:217)
==12925==    by 0x8097146: pdf_document_save(_EvDocument*, char const*, _GError**) (ev-poppler.cc:248)
==12925==    by 0x8092210: ev_document_save (ev-document.c:136)
==12925==    by 0x807AA7F: file_save_dialog_response_cb (ev-window.c:1676)
==12925==    by 0x5191542: g_cclosure_marshal_VOID(i_xx_t) (gmarshal.c:216)
==12925==    by 0x5182F8A: g_closure_invoke (gclosure.c:490)
==12925==    by 0x519476A: signal_emit_unlocked_R (gsignal.c:2438)
==12925==    by 0x5195BE2: g_signal_emit_valist (gsignal.c:2197)

Here is an updated patch that fixes both.
Comment 3 Albert Astals Cid 2007-01-28 07:37:03 UTC
Applied


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.