From: injun.yang Date: Mon, 1 Jun 2020 07:09:36 +0000 (+0900) Subject: Fix the memory leak X-Git-Tag: accepted/tizen/unified/20200624.130141~1 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fconnectivity%2Fbluetooth-agent.git;a=commitdiff_plain;h=08a0bfad6ca473e6903d2c9e1064d689c511fb22 Fix the memory leak [Model] All [BinType] AP [Customer] OPEN [Issue#] N/A [Request] Internal [Occurrence Version] N/A [Problem] memory leak [Cause & Measure] release memory [Checking Method] [Team] Convergence BT [Developer] Injun Yang [Solution company] Samsung [Change Type] Specification change Change-Id: Ie1c3b1e051825afc4653b255de7f7f37696356dc Signed-off-by: injun.yang Signed-off-by: Wootak Jung --- diff --git a/ag-agent/bluetooth-ag-agent.c b/ag-agent/bluetooth-ag-agent.c index a1f68b4..a3ef15d 100644 --- a/ag-agent/bluetooth-ag-agent.c +++ b/ag-agent/bluetooth-ag-agent.c @@ -3502,12 +3502,12 @@ static void __bt_ag_agent_method(GDBusConnection *connection, g_dbus_method_invocation_return_value(invocation, NULL); } else if (g_strcmp0(method_name, "SwapHeadset") == 0) { GSList *l; - gchar *addr = NULL; + const gchar *addr = NULL; char address[BT_ADDRESS_STRING_SIZE]; char remote_addr[BT_ADDRESS_STRING_SIZE]; gboolean device_found = FALSE; - g_variant_get(parameters, "(s)", &addr); + g_variant_get(parameters, "(&s)", &addr); g_strlcpy(address, addr, sizeof(address)); DBG("Sender = %s", sender); @@ -4045,14 +4045,14 @@ static void __bt_ag_name_owner_changed_cb(GDBusConnection *connection, gpointer user_data) { FN_START; - char *name_owner = NULL; - char *old_owner = NULL; - char *new_owner = NULL; + const char *name_owner = NULL; + const char *old_owner = NULL; + const char *new_owner = NULL; if (strcasecmp(signal_name, "NameOwnerChanged") == 0) { GSList *l; - g_variant_get(parameters, "(sss)", &name_owner, &old_owner, &new_owner); + g_variant_get(parameters, "(&s&s&s)", &name_owner, &old_owner, &new_owner); _bt_hfp_release_all_calls_by_sender(name_owner); diff --git a/hid-agent/bluetooth-hid-agent.c b/hid-agent/bluetooth-hid-agent.c index 8a95260..09008d3 100644 --- a/hid-agent/bluetooth-hid-agent.c +++ b/hid-agent/bluetooth-hid-agent.c @@ -144,13 +144,13 @@ static void __bt_hid_name_owner_changed_cb(GDBusConnection *connection, GVariant *parameters, gpointer user_data) { - char *name_owner = NULL; - char *old_owner = NULL; - char *new_owner = NULL; + const char *name_owner = NULL; + const char *old_owner = NULL; + const char *new_owner = NULL; int ret = 0; if (strcasecmp(signal_name, "NameOwnerChanged") == 0) { - g_variant_get(parameters, "(sss)", &name_owner, &old_owner, &new_owner); + g_variant_get(parameters, "(&s&s&s)", &name_owner, &old_owner, &new_owner); ret = _bt_hid_register_application(FALSE, name_owner); if (ret == BT_HID_AGENT_ERROR_NONE) { diff --git a/ipsp-agent/bluetooth-ipsp-agent.c b/ipsp-agent/bluetooth-ipsp-agent.c index 32a41db..8ad155c 100644 --- a/ipsp-agent/bluetooth-ipsp-agent.c +++ b/ipsp-agent/bluetooth-ipsp-agent.c @@ -759,6 +759,8 @@ static void __bt_ipsp_dbus_method(GDBusConnection *connection, g_free(network_ipv6_address); g_free(remote_ipv6_address); g_free(network_interface); + g_free(ifname); + g_free(address); } BT_DBG("-"); diff --git a/map-agent/bluetooth_map_agent.c b/map-agent/bluetooth_map_agent.c index 65fadc7..346dcfc 100644 --- a/map-agent/bluetooth_map_agent.c +++ b/map-agent/bluetooth_map_agent.c @@ -220,7 +220,6 @@ static map_msg_filter_t __bt_map_get_filters(GVariant *filters) DBG("FilterPriority :%u", filter.priority); } } - return filter; }