From: Wootak Jung Date: Tue, 14 May 2024 03:01:07 +0000 (+0900) Subject: Fix memory leak X-Git-Tag: accepted/tizen/9.0/unified/20241030.235745~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7fea8e8377a120eb1064be69bee87bcfa1c4bd59;p=platform%2Fcore%2Fconnectivity%2Fbluetooth-agent.git Fix memory leak Remove unnecessary log Change-Id: I4dc44cb8a5e3d9e003785b2dc8675de5dd829257 Signed-off-by: Wootak Jung --- diff --git a/hf-agent/bluetooth-hf-agent.c b/hf-agent/bluetooth-hf-agent.c index 0283016..0ac339b 100644 --- a/hf-agent/bluetooth-hf-agent.c +++ b/hf-agent/bluetooth-hf-agent.c @@ -3641,15 +3641,14 @@ static void __bt_hf_agent_filter_cb(GDBusConnection *connection, GVariant *parameters, gpointer user_data) { - DBG("+"); char *path = NULL; - - GVariant *optional_param; + GVariant *optional_param = NULL; if (strcasecmp(signal_name, "InterfacesAdded") == 0) { + g_variant_get(parameters, "(&o@a{sa{sv}})", &path, &optional_param); + if (optional_param) + g_variant_unref(optional_param); - g_variant_get(parameters, "(&o@a{sa{sv}})", - &path, &optional_param); if (!path) { ERR("Invalid adapter path"); return; @@ -3664,8 +3663,10 @@ static void __bt_hf_agent_filter_cb(GDBusConnection *connection, g_variant_get(parameters, "(&o@as)", &path, &optional_param); if (!path) __bt_hf_agent_unregister(); + + if (optional_param) + g_variant_unref(optional_param); } - DBG("-"); } static int __bt_hf_agent_get_adapter_path(GDBusConnection *conn, char *path)