Fix dereference NULL issue 90/236990/1
authorhyunho <hhstark.kang@samsung.com>
Wed, 24 Jun 2020 02:30:57 +0000 (11:30 +0900)
committerhyunho <hhstark.kang@samsung.com>
Wed, 24 Jun 2020 02:30:57 +0000 (11:30 +0900)
Change-Id: Idb2cd5e9083a43ad5e5dabdf005beb621e498613
Signed-off-by: hyunho <hhstark.kang@samsung.com>
watchface-complication/watchface-editable.cc

index fc1b72b..911ec68 100644 (file)
@@ -603,8 +603,14 @@ extern "C" EXPORT_API int watchface_editable_candidate_color_create(
     LOGE("Invalid parameter");
     return WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETER;
   }
+
   watchface_editable_color_h col =
       (watchface_editable_color_h)calloc(1, sizeof(struct editable_color_));
+  if (col == nullptr) {
+    LOGE("Out of memory");
+    return WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORY;
+  }
+
   col->r = r;
   col->g = g;
   col->b = b;