After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 552307 - small string leak
small string leak
Status: RESOLVED FIXED
Product: metacity
Classification: Other
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Metacity maintainers list
Metacity maintainers list
Depends on:
Blocks:
 
 
Reported: 2008-09-15 03:13 UTC by Matthias Clasen
Modified: 2009-01-28 02:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (612 bytes, patch)
2008-09-19 23:03 UTC, Matthias Clasen
committed Details | Review

Description Matthias Clasen 2008-09-15 03:13:52 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);
Comment 1 Matthias Clasen 2008-09-19 23:03:23 UTC
Created attachment 119020 [details] [review]
patch
Comment 2 Thomas Thurman 2009-01-28 02:01:47 UTC
Committed with thanks.