Fix the svace issue 74/133374/1
authorInjun Yang <injun.yang@samsung.com>
Mon, 12 Jun 2017 04:00:48 +0000 (13:00 +0900)
committerInjun Yang <injun.yang@samsung.com>
Mon, 12 Jun 2017 04:00:48 +0000 (13:00 +0900)
[Model] All
[BinType] AP
[Customer] OPEN

[Issue#] N/A
[Request] Internal
[Occurrence Version] N/A

[Problem] svace issue
[Cause & Measure] fix the code
[Checking Method] svace tool

[Team] Basic Connection
[Developer] Injun Yang
[Solution company] Samsung
[Change Type] Specification change

Change-Id: I00babc2548a4100b0cb6fd72a9b0b783a7612a67

bt-api/bt-telephony.c
bt-service/bt-service-network.c
bt-service/bt-service-pbap.c
bt-service/bt-service-tds.c
test/bluetooth-frwk-test.c

index 6de5881..67713eb 100644 (file)
@@ -1712,7 +1712,7 @@ static void __bluetooth_telephony_sco_start_cb(GDBusProxy *proxy,
                GAsyncResult *res, gpointer user_data)
 {
        GError *error = NULL;
-       GVariant *value;
+       GVariant *value = NULL;
 
        value = g_dbus_proxy_call_finish(proxy, res, &error);
        if (value == NULL) {
@@ -1723,6 +1723,8 @@ static void __bluetooth_telephony_sco_start_cb(GDBusProxy *proxy,
                } else {
                        BT_ERR("SCo Start Failed");
                }
+               g_object_unref(proxy);
+               return;
        }
 
        BT_DBG("sco_start_cb : -");
@@ -1784,7 +1786,7 @@ static void __bluetooth_telephony_sco_close_cb(GDBusProxy *proxy,
                GAsyncResult *res, gpointer user_data)
 {
        GError *error = NULL;
-       GVariant *value;
+       GVariant *value = NULL;
 
        value = g_dbus_proxy_call_finish(proxy, res, &error);
        if (value == NULL) {
@@ -1795,6 +1797,8 @@ static void __bluetooth_telephony_sco_close_cb(GDBusProxy *proxy,
                } else {
                        BT_ERR("SCo close Failed");
                }
+               g_object_unref(proxy);
+               return;
        }
 
        BT_DBG("sco_close_cb : -");
index 18875c7..b86831d 100644 (file)
@@ -148,8 +148,8 @@ static void __bt_network_connect_cb(GDBusProxy *proxy, GAsyncResult *res,
                        g_clear_error(&g_error);
                }
                result = BLUETOOTH_ERROR_INTERNAL;
-       }
-       g_variant_unref(reply);
+       } else
+               g_variant_unref(reply);
 
        func_data = user_data;
        if (func_data == NULL) {
@@ -207,8 +207,8 @@ static void __bt_network_disconnect_cb(GDBusProxy *proxy, GAsyncResult *res,
                        g_clear_error(&g_error);
                }
                result = BLUETOOTH_ERROR_INTERNAL;
-       }
-       g_variant_unref(reply);
+       } else
+               g_variant_unref(reply);
 
        func_data = user_data;
        if (func_data == NULL) {
index 335f3de..f18b4cb 100644 (file)
@@ -521,6 +521,9 @@ void __bt_pbap_get_phonebook_size_cb(GDBusProxy *proxy,
                                        error->code, error->message);
                        g_clear_error(&error);
                }
+               g_object_unref(proxy);
+               __bt_pbap_free_data(pbap_data);
+               return;
        } else {
                g_variant_get(value, "(q)", &size);
                result = BLUETOOTH_ERROR_NONE;
@@ -607,6 +610,9 @@ void __bt_pbap_get_vcard_list_cb(GDBusProxy *proxy,
                                        error->code, error->message);
                        g_clear_error(&error);
                }
+               g_object_unref(proxy);
+               __bt_pbap_free_data(pbap_data);
+               return;
        } else {
                result = BLUETOOTH_ERROR_NONE;
                gchar *elname, *elval;
@@ -727,6 +733,9 @@ void __bt_pbap_search_phonebook_cb(GDBusProxy *proxy,
                                        error->code, error->message);
                        g_clear_error(&error);
                }
+               g_object_unref(proxy);
+               __bt_pbap_free_data(pbap_data);
+               return;
        } else {
                result = BLUETOOTH_ERROR_NONE;
                gchar *elname, *elval;
index 13e216c..6c00fc5 100644 (file)
@@ -320,7 +320,7 @@ static unsigned char* __bt_tds_provider_get_tds_blocks(unsigned int *length)
        GSList *l;
        GSList *l1;
        unsigned int len = 0;
-       unsigned char data[TDS_DATA_LEN_MAX];
+       unsigned char data[TDS_DATA_LEN_MAX] = { 0, };
 
        retv_if(NULL == length, NULL);
 
index c653d71..e1f9608 100644 (file)
@@ -562,7 +562,7 @@ int test_input_callback(void *data)
                ret = bluetooth_authorize_device(&device_address, FALSE);
                if (ret < 0)
                        TC_PRT("%s failed with [0x%04x]", tc_table[23].tc_name, ret);
-                       break;
+               break;
        }
        case 25:
        {
@@ -1119,7 +1119,7 @@ int test_input_callback(void *data)
                ret = bluetooth_rfcomm_accept_connection(server_fd);
                if (ret < 0) {
                        TC_PRT("Failed with [0x%04x]", ret);
-                       TC_PRT("client fd: %d", client_fd);
+                       TC_PRT("server fd: %d", server_fd);
                }
 
                break;