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 709796 - gimarshalingtests: memory leaks with transfer full/container inout tests
gimarshalingtests: memory leaks with transfer full/container inout tests
Status: RESOLVED FIXED
Product: gobject-introspection
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2013-10-10 08:20 UTC by Simon Feltman
Modified: 2015-02-07 16:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gimarshallingtests: Fix memory leaks in transfer full/container inout tests (3.58 KB, patch)
2013-10-10 08:25 UTC, Simon Feltman
committed Details | Review

Description Simon Feltman 2013-10-10 08:20:03 UTC
There seem to be quite a few tests where arguments are marked as transfer full or container for inout arguments which do not free the input arg before overwriting it with the out value. I might be misinterpreting how this is supposed to function but it seems like marking an input arg (regardless of whether or not it is inout) should assume ownership and free the memory. For example, gi_marshalling_tests_gslist_utf8_container_inout doesn't call g_slist_free on the input argument before setting the out value:

https://git.gnome.org/browse/gobject-introspection/tree/tests/gimarshallingtests.c?h=gnome-3-10#n2818
Comment 1 Simon Feltman 2013-10-10 08:25:06 UTC
Created attachment 256881 [details] [review]
gimarshallingtests: Fix memory leaks in transfer full/container inout tests

Make sure to call the various free functions for container tests where
inout arguments are marked transfer full or container.
Comment 2 Colin Walters 2013-10-10 13:25:55 UTC
Review of attachment 256881 [details] [review]:

Right.  I think the reason this may not have been done in the past is there was some debate over the semantics of (inout) containers, but we've now settled on the idea that it does free the inbound container.
Comment 3 Simon Feltman 2013-10-10 22:43:08 UTC
Pushed with additional change of using g_ptr_array_unref instead of 
g_ptr_array_free.
Comment 4 André Klapper 2015-02-07 16:52:08 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]