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 691820 - Caller-allocated GValues and their memory are leaked
Caller-allocated GValues and their memory are leaked
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: general
Git master
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2013-01-16 02:01 UTC by Mike Gorse
Modified: 2013-01-17 06:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch. (2.95 KB, patch)
2013-01-16 02:09 UTC, Mike Gorse
committed Details | Review

Description Mike Gorse 2013-01-16 02:01:08 UTC
When a GValue is returned in space that the caller allocates, pyg_value_as_pyobject gets called and takes the pointer, string, etc. from the value, but the space allocated for the value is not freed. Also, if the value held a string, then the original string is leaked.
Comment 1 Mike Gorse 2013-01-16 02:09:08 UTC
Created attachment 233557 [details] [review]
Patch.

Patch to always call _cleanup_caller_allocates and add a parameter to indicate whether the argument was processed. Deallocate the memory where it should be done (ie, for GValues).
Comment 2 Martin Pitt 2013-01-17 06:58:16 UTC
Very nice, thank you!