GNOME Bugzilla – Bug 552307
small string leak
Last modified: 2009-01-28 02:01:47 UTC
==23147== 24 bytes in 6 blocks are definitely lost in loss record 3,011 of 6,118 ==23147== at 0x4006AEE: malloc (vg_replace_malloc.c:207) ==23147== by 0xA88873: g_malloc (gmem.c:131) ==23147== by 0x3510A6: (within /usr/lib/libgdk-x11-2.0.so.0.1400.0) ==23147== by 0x35163B: gdk_text_property_to_utf8_list_for_display (in /usr/lib/libgdk-x11-2.0.so.0.1400.0) ==23147== by 0x328F05: gdk_text_property_to_utf8_list (in /usr/lib/libgdk-x11-2.0.so.0.1400.0) ==23147== by 0x80AA4B8: meta_text_property_to_utf8 (ui.c:653) ==23147== by 0x808D811: text_property_from_results (xprops.c:649) ==23147== by 0x808DE0C: meta_prop_get_values (xprops.c:1137) The problem here is that gdk_text_property_to_utf8_list always returns an allocated list, even when the returned count is 0. So just change if (count == 0) return NULL; retval = list[0]; list[0] = g_strdup (""); /* something to free */ g_strfreev (list); to if (count == 0) retval = NULL else { retval = list[0]; list[0] = g_strdup (""); /* something to free */ } g_strfreev (list);
Created attachment 119020 [details] [review] patch
Committed with thanks.