diff options
author | Christophe Fergeau <cfergeau@redhat.com> | 2014-05-26 14:23:35 +0200 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2014-05-26 14:53:30 +0200 |
commit | 29336065f106b15f433c3c357f81207d3e811f8e (patch) | |
tree | aa7e726f9394a3f6b7c378838f342390f59398f8 | |
parent | 6f6b0221bfb413d6eb1f9b84c2bd0ade9c3b4784 (diff) |
Fix GVariant leak in IBusService::SetValue
When handling the DBus SetValue call,
ibusconfigservice.c:ibus_config_service_service_method_call()
gets a GVariant through g_variant_get("(&s&sv)")
GVariant documentation says that:
« Upon encountering a 'v', g_variant_get() takes a pointer to a
(GVariant *) (ie: (GVariant **) ). It is set to a new reference to a
GVariant instance containing the contents of the variant value. It is
appropriate to free this reference using g_variant_unref(). »
so we need to unreference it when we are done with it.
Running ibus-dconf in valgrind and then running tests/ibus-config
shows this leak:
==28085== 3,934 (1,520 direct, 2,414 indirect) bytes in 38 blocks are definitely lost in loss record 2,112 of 2,121
==28085== at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==28085== by 0x56EDDF2: g_malloc (gmem.c:97)
==28085== by 0x570691C: g_slice_alloc (gslice.c:1007)
==28085== by 0x572E6D9: g_variant_get_child_value (gvariant-core.c:1009)
==28085== by 0x57261C0: g_variant_get_variant (gvariant.c:715)
==28085== by 0x572BD03: g_variant_valist_get_nnp (gvariant.c:4794)
==28085== by 0x572C3F1: g_variant_valist_get_leaf (gvariant.c:4911)
==28085== by 0x572CAD4: g_variant_valist_get (gvariant.c:5092)
==28085== by 0x572CC59: g_variant_valist_get (gvariant.c:5127)
==28085== by 0x572D079: g_variant_get_va (gvariant.c:5354)
==28085== by 0x572CF9B: g_variant_get (gvariant.c:5301)
==28085== by 0x4E44E5B: ibus_config_service_service_method_call (ibusconfigservice.c:173)
-rw-r--r-- | src/ibusconfigservice.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/ibusconfigservice.c b/src/ibusconfigservice.c index e1777f9d..28db52e3 100644 --- a/src/ibusconfigservice.c +++ b/src/ibusconfigservice.c @@ -180,6 +180,7 @@ ibus_config_service_service_method_call (IBusService *service, g_dbus_method_invocation_return_gerror (invocation, error); g_error_free (error); } + g_variant_unref (value); return; } |