Add the status check logic for BT enable / disable method
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / bt-service-network.c
index 18875c7..3e643b7 100644 (file)
@@ -416,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;
 
@@ -479,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;