GNOME Bugzilla – Bug 627207
Memory leaks/double free
Last modified: 2010-08-19 19:06:12 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.
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.
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.
Created attachment 168221 [details] [review] Unit test for unregister_source This unit test should check the unregister_source method.
Patches pushed with changes. Thanks!