From: Paweł Stawicki
Date: Tue, 20 Mar 2018 17:32:38 +0000 (+0100)
Subject: [prevent][38358] Fix for resource leak
X-Git-Tag: accepted/tizen/unified/20180405.005254^0
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F40%2F173340%2F2;p=platform%2Fupstream%2Fat-spi2-core.git
[prevent][38358] Fix for resource leak
Change-Id: I26e7404fa047899f55d4150e2ed427aa097a681f
---
diff --git a/test/at_spi2_tool.c b/test/at_spi2_tool.c
index fb9739a..7039fb5 100644
--- a/test/at_spi2_tool.c
+++ b/test/at_spi2_tool.c
@@ -670,6 +670,7 @@ static void _at_spi_client_enable(gboolean enabled)
{
static GDBusProxy *proxy = NULL; //we keep proxy (dbus connection) until program exits
GVariant *result;
+ GVariant *enabled_variant;
GError *error = NULL;
GDBusProxyFlags flags = G_DBUS_PROXY_FLAGS_NONE;
@@ -690,13 +691,16 @@ static void _at_spi_client_enable(gboolean enabled)
}
}
+ enabled_variant = g_variant_new_boolean(enabled);
result = g_dbus_proxy_call_sync(proxy,
"Set",
- g_variant_new ("(ssv)", "org.a11y.Status", "IsEnabled", g_variant_new_boolean(enabled)),
+ g_variant_new ("(ssv)", "org.a11y.Status", "IsEnabled", enabled_variant),
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
&error);
+ if (enabled_variant)
+ g_variant_unref(enabled_variant);
if (result)
g_variant_unref(result);