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 743770 - Memory leak in plugman example
Memory leak in plugman example
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other Linux
: Normal trivial
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2015-01-31 15:22 UTC by Felix Riemann
Modified: 2015-02-01 16:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
close leak (1.31 KB, patch)
2015-01-31 15:22 UTC, Felix Riemann
committed Details | Review

Description Felix Riemann 2015-01-31 15:22:51 UTC
Created attachment 295853 [details] [review]
close leak

Just noticed a little memory leak in the plugman example.
When removing a menu entry it uses g_menu_model_get_item_attribute to get a string attribute but doesn't free the returned string.

It also shows up in Valgrind:

==6428== 16 bytes in 3 blocks are definitely lost in loss record 1,913 of 9,334
==6428==    at 0x4A06BCF: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6428==    by 0x5E2B319: g_malloc (gmem.c:97)
==6428==    by 0x5E4363E: g_strdup (gstrfuncs.c:356)
==6428==    by 0x5E5D407: g_variant_valist_get_nnp (gvariant.c:4743)
==6428==    by 0x5E5D407: g_variant_valist_get_leaf (gvariant.c:4913)
==6428==    by 0x5E5D407: g_variant_valist_get (gvariant.c:5094)
==6428==    by 0x5E5E24C: g_variant_get_va (gvariant.c:5356)
==6428==    by 0x58B983A: g_menu_model_get_item_attribute (gmenumodel.c:603)
==6428==    by 0x402E59: disable_plugin (plugman.c:275)
==6428==    by 0x402E59: enable_or_disable_plugin (plugman.c:300)
==6428==    by 0x5B9A234: g_closure_invoke (gclosure.c:768)
==6428==    by 0x5BAC20B: signal_emit_unlocked_R (gsignal.c:3536)
==6428==    by 0x5BB4984: g_signal_emit_valist (gsignal.c:3292)
==6428==    by 0x5BB4BA9: g_signal_emit (gsignal.c:3348)
==6428==    by 0x4F21CA7: gtk_toggle_button_clicked (gtktogglebutton.c:606)