From 48b10904519c2f7d3c5275e379e15df97f86b098 Mon Sep 17 00:00:00 2001 From: Hyuk Lee Date: Thu, 7 Apr 2016 17:54:00 +0900 Subject: [PATCH] Modify the memory leak Change-Id: Ia470cfab1742c655d7fadb273c42f41e5e89b77b Signed-off-by: Hyuk Lee --- ag-agent/bluetooth-ag-agent.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/ag-agent/bluetooth-ag-agent.c b/ag-agent/bluetooth-ag-agent.c index 0ee7885..4696ed0 100755 --- a/ag-agent/bluetooth-ag-agent.c +++ b/ag-agent/bluetooth-ag-agent.c @@ -3010,11 +3010,7 @@ static void __bt_ag_agent_method(GDBusConnection *connection, if (ret) goto fail; - if (local_addr) - g_free(local_addr); - - local_addr = g_strdup(address); - DBG("Address = %s\n", local_addr); + DBG("Address = %s\n", address); g_dbus_method_invocation_return_value(invocation, NULL); } else if (g_strcmp0(method_name, "UnregisterApplication") == 0) { gchar *path = NULL; @@ -3978,13 +3974,15 @@ static void __bt_ag_agent_filter_cb(GDBusConnection *connection, { FN_START; 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 (!path) { + if (optional_param) + g_variant_unref(optional_param); ERR("Invalid adapter path"); return; } @@ -4002,6 +4000,8 @@ static void __bt_ag_agent_filter_cb(GDBusConnection *connection, } else if (strcasecmp(signal_name, "InterfacesRemoved") == 0) { g_variant_get(parameters, "(&o@as)", &path, &optional_param); if (!path) { + if (optional_param) + g_variant_unref(optional_param); ERR("Invalid adapter path"); return; } @@ -4016,6 +4016,9 @@ static void __bt_ag_agent_filter_cb(GDBusConnection *connection, } } + if (optional_param) + g_variant_unref(optional_param); + FN_END; } @@ -4230,6 +4233,12 @@ static void __bt_ag_agent_media_filter_cb(GDBusConnection *connection, } } + if (dict_param) + g_variant_unref(dict_param); + + if (optional_param) + g_variant_unref(optional_param); + FN_END; } #endif -- 2.7.4