From: Hyuk Lee Date: Thu, 7 Apr 2016 08:54:00 +0000 (+0900) Subject: Modify the memory leak X-Git-Tag: accepted/tizen/common/20160411.130043^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F11%2F65111%2F3;p=platform%2Fcore%2Fconnectivity%2Fbluetooth-agent.git Modify the memory leak Change-Id: Ia470cfab1742c655d7fadb273c42f41e5e89b77b Signed-off-by: Hyuk Lee --- 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