Branch: refs/heads/master
  Home:   https://github.com/ibus/ibus
  Commit: 5d887bde04d2fcfeb18437bbf675baf4a21e31e2
      
https://github.com/ibus/ibus/commit/5d887bde04d2fcfeb18437bbf675baf4a21e31e2
  Author: Christophe Fergeau <[email protected]>
  Date:   2014-06-06 (Fri, 06 Jun 2014)

  Changed paths:
    M src/ibusconfigservice.c

  Log Message:
  -----------
  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)

BUG=http://code.google.com/p/ibus/issues/detail?id=1712

Review URL: https://codereview.appspot.com/108740044
Patch from Christophe Fergeau <[email protected]>.


-- 
-- 
You received this message because you are subscribed to the Google
Groups "ibus-devel" group.
iBus project web page: http://code.google.com/p/ibus/
iBus dev group: http://groups.google.com/group/ibus-devel?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"ibus-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

回复