elm_color_class: add null checking after memory allocation 40/143240/2
authorJaeun Choi <jaeun12.choi@samsung.com>
Wed, 9 Aug 2017 07:16:35 +0000 (16:16 +0900)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Fri, 11 Aug 2017 02:28:35 +0000 (02:28 +0000)
origin: upstream (15bbf4712ee1e9356fa975de6f2861bc5ce3076a)

Change-Id: Id9b82282635f8b722f6d282f3d0e84ee98aafdb0

src/lib/elm_color_class.c

index 39b90da..3e63016 100644 (file)
@@ -219,6 +219,8 @@ _colorclass_activate(void *data, Eo *obj EINA_UNUSED,
    else
      {
         cc->current = calloc(1, sizeof(Colorclass)); //actually Elm_Color_Overlay
+        if (!cc->current) return;
+
         memcpy(cc->current, ecc, sizeof(Elm_Color_Overlay));
         cc->current->name = eina_stringshare_ref(ecc->name);
      }
@@ -691,6 +693,8 @@ elm_color_class_editor_add(Evas_Object *obj)
              Colorclass *lcc;
 
              ecc2 = malloc(sizeof(Edje_Color_Class));
+             if (!ecc2) continue;
+
              memcpy(ecc2, ecc, sizeof(Edje_Color_Class));
              ecc2->name = eina_stringshare_add(ecc->name);
              if (tl_cb)
@@ -819,6 +823,8 @@ elm_color_class_util_edje_file_list(Eina_File *f)
    EINA_ITERATOR_FOREACH(it, ecc)
      {
         ecc2 = malloc(sizeof(Edje_Color_Class));
+        if (!ecc2) continue;
+
         memcpy(ecc2, ecc, sizeof(Edje_Color_Class));
         ecc2->name = eina_stringshare_add(ecc->name);
         if (tl_cb)