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 627207 - Memory leaks/double free
Memory leaks/double free
Status: RESOLVED FIXED
Product: grilo
Classification: Other
Component: core
git master
Other Linux
: Normal normal
: ---
Assigned To: grilo-maint
grilo-maint
Depends on:
Blocks:
 
 
Reported: 2010-08-17 20:21 UTC by Simon Pena
Modified: 2010-08-19 19:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Testcase showing a crash when the sources are freed (2.18 KB, text/x-csrc)
2010-08-17 20:21 UTC, Simon Pena
  Details
Patch partially fixing the bug (1.82 KB, patch)
2010-08-17 20:26 UTC, Simon Pena
none Details | Review
Patch fixing the bug (869 bytes, patch)
2010-08-18 18:26 UTC, Simon Pena
none Details | Review
Unit test for unregister_source (2.11 KB, patch)
2010-08-18 19:06 UTC, Simon Pena
none Details | Review

Description Simon Pena 2010-08-17 20:21:17 UTC
Created attachment 168132 [details]
Testcase showing a crash when the sources are freed

Sources' properties 'id' and 'name' are freed in grl-media-source.c and grl-plugin-registry.c after being retrieved using g_object_get. As the get_property method wasn't duplicating them, those properties were being double freed.

This test case, based on the example provided in the documentation, simply loads all available plugins and sources, and, after that, unregisters them: when those objects are unref'd, the application crashes.
Comment 1 Simon Pena 2010-08-17 20:26:09 UTC
Created attachment 168134 [details] [review]
Patch partially fixing the bug

This patch removes the extra 'frees'. 

However, another crash is still being produced when grl_media_plugin_finalize is called and info->id and info->filename are freed. Commenting those lines fixes it, but I haven't yet managed to understand where they were freed the first time.
Comment 2 Simon Pena 2010-08-18 18:26:25 UTC
Created attachment 168219 [details] [review]
Patch fixing the bug

This patch fixes the bug: PluginInfo's ID was assigned from a heap constant, so it couldn't be freed.
Comment 3 Simon Pena 2010-08-18 19:06:15 UTC
Created attachment 168221 [details] [review]
Unit test for unregister_source

This unit test should check the unregister_source method.
Comment 4 Víctor Manuel Jáquez Leal 2010-08-19 19:06:12 UTC
Patches pushed with changes. Thanks!