GNOME Bugzilla – Bug 709796
gimarshalingtests: memory leaks with transfer full/container inout tests
Last modified: 2015-02-07 16:52:08 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
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.
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.
Pushed with additional change of using g_ptr_array_unref instead of g_ptr_array_free.
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]