Modify the privilege for battry RX / TX function
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / bt-service-network.c
index 439218d..3e643b7 100644 (file)
@@ -148,9 +148,8 @@ static void __bt_network_connect_cb(GDBusProxy *proxy, GAsyncResult *res,
                        g_clear_error(&g_error);
                }
                result = BLUETOOTH_ERROR_INTERNAL;
-       } else {
-               g_variant_unref(reply);
        }
+       g_variant_unref(reply);
 
        func_data = user_data;
        if (func_data == NULL) {
@@ -208,9 +207,8 @@ static void __bt_network_disconnect_cb(GDBusProxy *proxy, GAsyncResult *res,
                        g_clear_error(&g_error);
                }
                result = BLUETOOTH_ERROR_INTERNAL;
-       } else {
-               g_variant_unref(reply);
        }
+       g_variant_unref(reply);
 
        func_data = user_data;
        if (func_data == NULL) {
@@ -418,6 +416,8 @@ int _bt_network_connect(int request_id, int role,
        g_variant_unref(result);
        retv_if(profile_proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
        func_data = g_malloc0(sizeof(bt_function_data_t));
+       retv_if(func_data == NULL, BLUETOOTH_ERROR_MEMORY_ALLOCATION);
+
        func_data->address = g_strdup(address);
        func_data->req_id = request_id;
 
@@ -481,6 +481,8 @@ int _bt_network_disconnect(int request_id,
        g_variant_unref(result);
        retv_if(profile_proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
        func_data = g_malloc0(sizeof(bt_function_data_t));
+       retv_if(func_data == NULL, BLUETOOTH_ERROR_MEMORY_ALLOCATION);
+
        func_data->address = g_strdup(address);
        func_data->req_id = request_id;