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 617980 - Memory leak in GconfClient::get()
Memory leak in GconfClient::get()
Status: RESOLVED OBSOLETE
Product: gnome-perl
Classification: Bindings
Component: Gnome2::GConf
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk2-perl-bugs
gtk2-perl-bugs
Depends on:
Blocks:
 
 
Reported: 2010-05-07 00:04 UTC by Dave Koberstein
Modified: 2016-11-26 19:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch for GconfClient::get() memory leak (443 bytes, patch)
2010-05-07 00:04 UTC, Dave Koberstein
none Details | Review
updated patch (474 bytes, patch)
2010-05-20 19:46 UTC, Dave Koberstein
none Details | Review

Description Dave Koberstein 2010-05-07 00:04:34 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.
Comment 1 Dave Koberstein 2010-05-20 19:46:53 UTC
Created attachment 161584 [details] [review]
updated patch

Updated patch checks for null before calling gconf_value_free()
Comment 2 khatar 2016-11-26 19:35:39 UTC
as GConf was replaced by Dconf and GSettings and isn't maintained actively, i think no one cares anymore.