mem-leak caused by load_icon()

Bug #438743 reported by Mirco Müller
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
notify-osd (Ubuntu)
Invalid
Medium
Karl Lattimer

Bug Description

When loading an icon via load_icon() valgrind reports huge leaks (100 - 400 KBytes depending on icon). The log looks like this:

...
==18155== 55,296 bytes in 864 blocks are still reachable in loss record 5,876 of 5,880
==18155== at 0x4C26A2F: realloc (vg_replace_malloc.c:429)
==18155== by 0x81951CE: g_realloc (gmem.c:170)
==18155== by 0x81AEDD6: g_string_maybe_expand (gstring.c:361)
==18155== by 0x81AFA12: g_string_insert_len (gstring.c:696)
==18155== by 0x817C3A1: g_build_path_va (gfileutils.c:1459)
==18155== by 0x817C668: g_build_filename (gfileutils.c:1729)
==18155== by 0x60BEED8: insert_theme (gtkicontheme.c:2550)
==18155== by 0x60BEFE7: insert_theme (gtkicontheme.c:1005)
==18155== by 0x60BFFC8: ensure_valid_themes (gtkicontheme.c:1053)
==18155== by 0x60C0652: choose_icon (gtkicontheme.c:1264)
==18155== by 0x60C1DF0: gtk_icon_theme_lookup_icon (gtkicontheme.c:1432)
==18155== by 0x60C1FDB: gtk_icon_theme_load_icon (gtkicontheme.c:1538)
==18155==
==18155==
==18155== 62,208 bytes in 864 blocks are still reachable in loss record 5,877 of 5,880
==18155== at 0x4C268FE: malloc (vg_replace_malloc.c:207)
==18155== by 0x81952A2: g_malloc (gmem.c:131)
==18155== by 0x60BEEF0: insert_theme (gtkicontheme.c:2561)
==18155== by 0x60BEFE7: insert_theme (gtkicontheme.c:1005)
==18155== by 0x60BFFC8: ensure_valid_themes (gtkicontheme.c:1053)
==18155== by 0x60C0652: choose_icon (gtkicontheme.c:1264)
==18155== by 0x60C1DF0: gtk_icon_theme_lookup_icon (gtkicontheme.c:1432)
==18155== by 0x60C1FDB: gtk_icon_theme_load_icon (gtkicontheme.c:1538)
==18155== by 0x412C4D: bubble_set_icon (bubble.c:1844)
==18155== by 0x41F3CB: stack_notify_handler (stack.c:735)
==18155== by 0x41D715: dbus_glib_marshal_stack_VOID__STRING_UINT_STRING_STRING_STRING_BOXED_BOXED_INT_POINTER (stack-glue.h:100)
==18155== by 0x54FD7EB: (within /usr/lib/libdbus-glib-1.so.2.1.0)
==18155==
==18155==
==18155== 98,304 bytes in 1 blocks are still reachable in loss record 5,878 of 5,880
==18155== at 0x4C246D4: calloc (vg_replace_malloc.c:397)
==18155== by 0x8195247: g_malloc0 (gmem.c:151)
==18155== by 0x817E3F3: g_hash_table_insert_internal (ghash.c:409)
==18155== by 0x60C0379: ensure_valid_themes (gtkicontheme.c:1141)
==18155== by 0x60C0652: choose_icon (gtkicontheme.c:1264)
==18155== by 0x60C1DF0: gtk_icon_theme_lookup_icon (gtkicontheme.c:1432)
==18155== by 0x60C1FDB: gtk_icon_theme_load_icon (gtkicontheme.c:1538)
==18155== by 0x412C4D: bubble_set_icon (bubble.c:1844)
==18155== by 0x41F3CB: stack_notify_handler (stack.c:735)
==18155== by 0x41D715: dbus_glib_marshal_stack_VOID__STRING_UINT_STRING_STRING_STRING_BOXED_BOXED_INT_POINTER (stack-glue.h:100)
==18155== by 0x54FD7EB: (within /usr/lib/libdbus-glib-1.so.2.1.0)
==18155== by 0x54FDCA4: (within /usr/lib/libdbus-glib-1.so.2.1.0)
==18155==
==18155==
==18155== 235,693 bytes in 12,814 blocks are still reachable in loss record 5,879 of 5,880
==18155== at 0x4C268FE: malloc (vg_replace_malloc.c:207)
==18155== by 0x81952A2: g_malloc (gmem.c:131)
==18155== by 0x81AE568: g_strndup (gstrfuncs.c:155)
==18155== by 0x60BF187: insert_theme (gtkicontheme.c:2455)
==18155== by 0x60BEFE7: insert_theme (gtkicontheme.c:1005)
==18155== by 0x60BFFC8: ensure_valid_themes (gtkicontheme.c:1053)
==18155== by 0x60C0652: choose_icon (gtkicontheme.c:1264)
==18155== by 0x60C1DF0: gtk_icon_theme_lookup_icon (gtkicontheme.c:1432)
==18155== by 0x60C1FDB: gtk_icon_theme_load_icon (gtkicontheme.c:1538)
==18155== by 0x412C4D: bubble_set_icon (bubble.c:1844)
==18155== by 0x41F3CB: stack_notify_handler (stack.c:735)
==18155== by 0x41D715: dbus_glib_marshal_stack_VOID__STRING_UINT_STRING_STRING_STRING_BOXED_BOXED_INT_POINTER (stack-glue.h:100)
==18155==
==18155==
==18155== 486,912 bytes in 161 blocks are still reachable in loss record 5,880 of 5,880
==18155== at 0x4C246D4: calloc (vg_replace_malloc.c:397)
==18155== by 0x8195247: g_malloc0 (gmem.c:151)
==18155== by 0x817E3F3: g_hash_table_insert_internal (ghash.c:409)
==18155== by 0x60BF1C7: insert_theme (gtkicontheme.c:2459)
==18155== by 0x60BEFE7: insert_theme (gtkicontheme.c:1005)
==18155== by 0x60BFFC8: ensure_valid_themes (gtkicontheme.c:1053)
==18155== by 0x60C0652: choose_icon (gtkicontheme.c:1264)
==18155== by 0x60C1DF0: gtk_icon_theme_lookup_icon (gtkicontheme.c:1432)
==18155== by 0x60C1FDB: gtk_icon_theme_load_icon (gtkicontheme.c:1538)
==18155== by 0x412C4D: bubble_set_icon (bubble.c:1844)
==18155== by 0x41F3CB: stack_notify_handler (stack.c:735)
==18155== by 0x41D715: dbus_glib_marshal_stack_VOID__STRING_UINT_STRING_STRING_STRING_BOXED_BOXED_INT_POINTER (stack-glue.h:100)
...

Mirco Müller (macslow)
Changed in notify-osd:
milestone: none → ubuntu-9.10
assignee: nobody → Mirco Müller (macslow)
importance: Undecided → Medium
status: New → Confirmed
David Barth (dbarth)
Changed in notify-osd:
milestone: ubuntu-9.10 → ubuntu-9.12
David Barth (dbarth)
Changed in notify-osd:
milestone: ubuntu-9.12 → none
Karl Lattimer (karl-qdh)
Changed in notify-osd:
assignee: Mirco Müller (macslow) → Karl Lattimer (karl-qdh)
Revision history for this message
Karl Lattimer (karl-qdh) wrote :

I'm not sure this leak is in notify-osd it seems to be in gtkicontheme.c

Revision history for this message
Karl Lattimer (karl-qdh) wrote :

The code around this valgrind has changed significantly, a few hundred lines worth of significantly so the valgrind logs here are invalid. The actual execution is completely reworked around this region.

I'll merge this bug into the valgrind reminder: bug #610389

Changed in notify-osd:
status: Confirmed → Invalid
Revision history for this message
Mirco Müller (macslow) wrote :

Might be something for a curious person... write a stand-alone test just using GtkIconTheme and valgrind that one, to find the exact spot where the leak happens.

affects: notify-osd → notify-osd (Ubuntu)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.