Fix incorrect memory validation for g_malloc*()
[platform/core/connectivity/bluetooth-frwk.git] / bt-api / bt-gatt-client.c
index 108d119..5e27343 100644 (file)
@@ -94,10 +94,6 @@ static char **__get_string_array_from_gptr_array(GPtrArray *gp)
 
        path = g_malloc0((gp->len + 1) * sizeof(char *));
 
-       /* Fix : NULL_RETURNS */
-       if (path == NULL)
-               return NULL;
-
        for (i = 0; i < gp->len; i++) {
                gp_path = g_ptr_array_index(gp, i);
                path[i] = g_strdup(gp_path);
@@ -1229,13 +1225,9 @@ static int __bluetooth_gatt_descriptor_iter(const char *char_handle,
                                g_variant_get(value, "ay", &desc_value_iter);
                                len = g_variant_get_size((GVariant *)desc_value_iter);
 
-                               if (len > 0) {
+                               if (len > 0)
                                        characteristic->description = (char *)g_malloc0(len + 1);
-                                       if (!characteristic->description) {
-                                               ret = BLUETOOTH_ERROR_OUT_OF_MEMORY;
-                                               goto done;
-                                       }
-                               }
+
                                for (i = 0; i < len; i++) {
                                        g_variant_iter_loop(desc_value_iter, "y",
                                                &characteristic->description[i]);
@@ -1255,7 +1247,6 @@ static int __bluetooth_gatt_descriptor_iter(const char *char_handle,
                }
        }
 
-done:
        g_variant_iter_free(property_iter);
        g_variant_unref(result);
        g_object_unref(properties_proxy);