From 297311447d7af9a002da2b0c3d504f3dc806e396 Mon Sep 17 00:00:00 2001 From: Wootak Jung Date: Tue, 10 Apr 2018 15:48:09 +0900 Subject: [PATCH] Fix the coverity issues - Fix memory leak issues - Modify variable name for readability Change-Id: Iaea7edcb18439b4b127aedbd6b263fe21da7d81d --- ag-agent/bluetooth-ag-agent.c | 21 ++++++++++----------- bt-ipsp/bt-ipsp.c | 3 ++- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ag-agent/bluetooth-ag-agent.c b/ag-agent/bluetooth-ag-agent.c index 00cb6c2..ffa595d 100644 --- a/ag-agent/bluetooth-ag-agent.c +++ b/ag-agent/bluetooth-ag-agent.c @@ -4041,9 +4041,7 @@ static void __bt_ag_agent_filter_cb(GDBusConnection *connection, GVariant *optional_param = NULL; if (strcasecmp(signal_name, "InterfacesAdded") == 0) { - - g_variant_get(parameters, "(&o@a{sa{sv}})", - &path, &optional_param); + g_variant_get(parameters, "(&o@a{sa{sv}})", &path, &optional_param); if (!path) { if (optional_param) g_variant_unref(optional_param); @@ -4053,12 +4051,12 @@ static void __bt_ag_agent_filter_cb(GDBusConnection *connection, INFO("Adapter Path = [%s]", path); if (strcasecmp(path, DEFAULT_ADAPTER_OBJECT_PATH) == 0) { - gchar *path = g_strdup(BT_AG_AGENT_OBJECT_PATH); - __bt_ag_agent_register(path, hfp_ver, + gchar *obj_path = g_strdup(BT_AG_AGENT_OBJECT_PATH); + __bt_ag_agent_register(obj_path, hfp_ver, HFP_AG_UUID, "Hands-Free Audio Gateway"); - path = g_strdup(BT_HS_AG_AGENT_OBJECT_PATH); - __bt_ag_agent_register(path, hsp_ver, + obj_path = g_strdup(BT_HS_AG_AGENT_OBJECT_PATH); + __bt_ag_agent_register(obj_path, hsp_ver, HSP_AG_UUID, "Headset Audio Gateway"); } } else if (strcasecmp(signal_name, "InterfacesRemoved") == 0) { @@ -4072,13 +4070,14 @@ static void __bt_ag_agent_filter_cb(GDBusConnection *connection, INFO("Adapter Path = [%s]", path); if (strcasecmp(path, DEFAULT_ADAPTER_OBJECT_PATH) == 0) { - gchar *path = g_strdup(BT_AG_AGENT_OBJECT_PATH); - __bt_ag_agent_unregister(path); + gchar *obj_path = g_strdup(BT_AG_AGENT_OBJECT_PATH); + __bt_ag_agent_unregister(obj_path); - path = g_strdup(BT_HS_AG_AGENT_OBJECT_PATH); - __bt_ag_agent_unregister(path); + obj_path = g_strdup(BT_HS_AG_AGENT_OBJECT_PATH); + __bt_ag_agent_unregister(obj_path); } } + g_free(path); if (optional_param) g_variant_unref(optional_param); diff --git a/bt-ipsp/bt-ipsp.c b/bt-ipsp/bt-ipsp.c index ed37cc6..4017f2f 100644 --- a/bt-ipsp/bt-ipsp.c +++ b/bt-ipsp/bt-ipsp.c @@ -746,7 +746,8 @@ static void __bt_ipsp_dbus_method(GDBusConnection *connection, __bt_ipsp_add_ipv6_route(network_interface, network_ipv6_address, 64); g_free(network_ipv6_address); - + g_free(remote_ipv6_address); + g_free(network_interface); } BT_DBG("-"); -- 2.7.4