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 655173 - small memory leak in GtkStyleProperty
small memory leak in GtkStyleProperty
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Class: GtkStyleContext
3.1.x
Other Linux
: Normal trivial
: ---
Assigned To: Carlos Garnacho
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2011-07-23 13:48 UTC by Felix Riemann
Modified: 2011-07-23 19:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
trivial fix (873 bytes, patch)
2011-07-23 13:52 UTC, Felix Riemann
accepted-commit_now Details | Review

Description Felix Riemann 2011-07-23 13:48:37 UTC
Spotted this multiple times in valgrind:

==3475== 20 bytes in 2 blocks are definitely lost in loss record 2,851 of 12,554
==3475==    at 0x4C29BFD: malloc (vg_replace_malloc.c:236)
==3475==    by 0xBAABA02: g_malloc (gmem.c:164)
==3475==    by 0xBAC3EAD: g_strdup (gstrfuncs.c:100)
==3475==    by 0xBAC5F6A: g_strdupv (gstrfuncs.c:2603)
==3475==    by 0xAFFD0AF: boxed_proxy_lcopy_value (gboxed.c:247)
==3475==    by 0x54689C2: gtk_style_properties_get_valist (gtkstyleproperties.c:755)
==3475==    by 0x5468EB2: gtk_style_properties_get (gtkstyleproperties.c:808)
==3475==    by 0x546AA76: pack_font_description (gtkstyleproperty.c:1993)
==3475==    by 0x5468AE9: gtk_style_properties_get_valist (gtkstyleproperties.c:762)
==3475==    by 0x5468EB2: gtk_style_properties_get (gtkstyleproperties.c:808)
==3475==    by 0x5465C43: gtk_style_context_get_font (gtkstylecontext.c:3481)
==3475==    by 0x5531752: update_pango_context (gtkwidget.c:9041)
==3475==    by 0x5531BAA: gtk_widget_create_pango_context (gtkwidget.c:9101)
==3475==    by 0x5531CAF: gtk_widget_get_pango_context (gtkwidget.c:9022)
==3475==    by 0x5531D47: gtk_widget_create_pango_layout (gtkwidget.c:9133)
==3475==    by 0x5331038: gtk_color_button_init (gtkcolorbutton.c:473)
==3475==    by 0xB025B2A: g_type_create_instance (gtype.c:1885)
==3475==    by 0xB00367B: g_object_constructor (gobject.c:1629)
==3475==    by 0x5308696: gtk_button_constructor (gtkbutton.c:598)
==3475==    by 0xB006437: g_object_newv (gobject.c:1493)
==3475==    by 0x5304474: _gtk_builder_construct (gtkbuilder.c:661)
==3475==    by 0x5304908: builder_construct.clone.4 (gtkbuilderparser.c:196)
==3475==    by 0x53062C9: end_element (gtkbuilderparser.c:980)
==3475==    by 0xBAA9A03: g_markup_parse_context_parse (gmarkup.c:1561)
==3475==    by 0x53065FF: _gtk_builder_parser_parse_buffer (gtkbuilderparser.c:1161)

Trivial fix follows in a second.
Comment 1 Felix Riemann 2011-07-23 13:52:35 UTC
Created attachment 192527 [details] [review]
trivial fix

gtkstyleproperty: fix small memory leak

The released value is a string array and thus g_free is not sufficient.

https://bugzilla.gnome.org/show_bug.cgi?id=655173
Comment 2 Matthias Clasen 2011-07-23 18:44:49 UTC
Review of attachment 192527 [details] [review]:

Looks right.
Comment 3 Felix Riemann 2011-07-23 19:48:25 UTC
Pushed to master:

commit e8486fdf710ce49da0c0a70ff9bbe6645bd5e3ae
Author: Felix Riemann <>
Date:   Sat Jul 23 15:50:05 2011 +0200

    gtkstyleproperty: fix small memory leak
    
    The released value is a string array and thus g_free is not sufficient.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=655173