GNOME Bugzilla – Bug 617980
Memory leak in GconfClient::get()
Last modified: 2016-11-26 19:35:39 UTC
Created attachment 160479 [details] [review] patch for GconfClient::get() memory leak In Gconf::Client provided by rpm perl-Gnome2-GConf.i386-1.044-1.fc8 there appears to be a memory leak in the get method. Running this code snippet while monitoring the script in top is enough to see the issue within a minute: ## <...snip...> my $client = Gnome2::GConf::Client->get_default; while (1) { my $keyhash = $client->get('/my/valid/key'); #print Dumper $keyhash; } ## end Where the key is a valid key when checked by uncommenting the print statement. The issue appears to be that GConf's gconf_client_get() is not being used correctly in GConfClient.xs. gconf_client_get_string() in GConf and the other type-specific methods call gconf_client_get() and then free the GConfValue returned by gconf_client_get() with gconf_value_free(). So it appears that GConfClient.xs's gconf_client_get() should do the same. To fix it I added: CLEANUP: gconf_value_free (RETVAL); to the end of GconfClient.xs's implementation of gconf_client_get(). It resolved the leak for me. Patch attached.
Created attachment 161584 [details] [review] updated patch Updated patch checks for null before calling gconf_value_free()
as GConf was replaced by Dconf and GSettings and isn't maintained actively, i think no one cares anymore.