[Goodies-dev] [Bug 3064] Memory leak in sensors

bugzilla-daemon at xfce.org bugzilla-daemon at xfce.org
Tue Mar 27 16:08:00 CEST 2007


DO NOT REPLY TO THIS EMAIL.  Also, do not reply via email to the person
whose email is mentioned below.  To comment on this bug, please visit:
http://bugzilla.xfce.org/show_bug.cgi?id=3064





------- Comment #1 from nick at xfce.org  2007-03-27 14:07 UTC -------
Using g_strdup_printf in this plugin is completely wrong, you duplicate string
all the time and they are not freed.
Please use GString instead. Like so:

GString *labeltext = g_string_new ("");

while (sensors)
  {
    g_string_append_printf (labeltext, "The temp is %d degrees", celcius);

    if (itemsToDisplay > 1)
      labeltext = g_string_append_c (labeltext, '\n');
  }

gtk_label_set_markup (GTK_LABEL(label), labeltext->str);
g_string_free (labeltext, TRUE);

I think that will make your live much easier and it removes all the leaks.


-- 
Configure bugmail: http://bugzilla.xfce.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the Goodies-dev mailing list