Fix bluetooth-ag-agent crash [JIRA-TFIVE-1145]
[platform/core/connectivity/bluetooth-agent.git] / ag-agent / bluetooth-ag-agent.c
index fe6bb3e..099485c 100644 (file)
@@ -2364,7 +2364,7 @@ static struct event at_event_callbacks[] = {
 int num_of_secure_command = 4;
 static const char* secure_command[] = {"CLCC", "CLIP", "CPBR", "CCWA"};
 
-void __bt_ag_agent_print_at_buffer(char *message, const char *buf)
+static void __bt_ag_agent_print_at_buffer(char *message, const char *buf)
 {
 
        int i = 0;
@@ -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,11 +4070,11 @@ 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);
                }
        }