Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1460)

Issue 108740044: Fix GVariant leak in IBusService::SetValue (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years ago by fujiwara
Modified:
10 years ago
Reviewers:
shawn.p.huang, Peng
CC:
shawn.p.huang_gmail.com, fujiwara, cfergeau_redhat.com
Base URL:
git://github.com/ibus/ibus.git@master
Visibility:
Public.

Description

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

Patch Set 1 #

Patch Set 2 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1 line, -0 lines) Patch
M src/ibusconfigservice.c View 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 2
fujiwara
10 years ago (2014-06-04 08:07:45 UTC) #1
Peng
10 years ago (2014-06-05 14:14:49 UTC) #2
lgtm
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b