Remove unnecessary check 65/103365/1
authorSeungyoun Ju <sy39.ju@samsung.com>
Wed, 7 Dec 2016 08:38:49 +0000 (17:38 +0900)
committerSeungyoun Ju <sy39.ju@samsung.com>
Thu, 8 Dec 2016 06:37:35 +0000 (15:37 +0900)
[Model] COMMON
[BinType] AP
[Customer] OPEN

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

[Problem] g_malloc always returns proper memory location. If it is not
 available, abort will happenes. So its return value doesn't need to
 check.
[Cause & Measure] g_malloc's return value was checked.
[Checking Method] Code review

[Team] Basic connection
[Developer] Seungyoun Ju
[Solution company] Samsung
[Change Type] Specification change

Change-Id: I97cb2ba2011fa20a908007ce4dcd5350ea6d0c6f

bt-api/bt-gatt-service.c

index e318d14..81a6ecc 100644 (file)
@@ -751,15 +751,6 @@ static void __bt_gatt_char_method_call(GDBusConnection *connection,
                        char *data;
 
                        value_change.att_value = (guint8 *)g_malloc(len);
-                       if (!value_change.att_value) {
-                               BT_ERR("att_value is NULL");
-                               g_variant_unref(var);
-                               if (response_needed)
-                                       g_dbus_method_invocation_return_value(invocation, NULL);
-                               else
-                                       g_object_unref(invocation);
-                               return;
-                       }
 
                        data = (char *)g_variant_get_data(var);
                        memcpy(value_change.att_value, data, len);
@@ -989,15 +980,7 @@ static void __bt_gatt_desc_method_call(GDBusConnection *connection,
                        char *data;
 
                        value_change.att_value = (guint8 *)g_malloc(len);
-                       if (!value_change.att_value) {
-                               BT_ERR("att_value is NULL");
-                               g_variant_unref(var);
-                               if (response_needed)
-                                       g_dbus_method_invocation_return_value(invocation, NULL);
-                               else
-                                       g_object_unref(invocation);
-                               return;
-                       }
+
                        data = (char *)g_variant_get_data(var);
                        memcpy(value_change.att_value, data, len);
                }