cnp: Add safety check for NULL pointer from calloc() for anim_icon.
authorYoungbok Shin <youngb.shin@samsung.com>
Fri, 12 Jun 2015 08:01:55 +0000 (11:01 +0300)
committerDaniel Zaoui <daniel.zaoui@yahoo.com>
Fri, 12 Jun 2015 08:01:55 +0000 (11:01 +0300)
Summary:
It could be failed to allocate memory for Anim_Icon.
CID - 337351
@fix

Reviewers: raster, thiepha, woohyun, Hermet

Differential Revision: https://phab.enlightenment.org/D2672

src/lib/elm_cnp.c

index d2bd5e0..12f71fb 100644 (file)
@@ -4339,6 +4339,13 @@ _anim_icons_make(Eina_List *icons)
    EINA_LIST_FOREACH(icons, itr, o)
      {  /* Now add icons to animation window */
         Anim_Icon *st = calloc(1, sizeof(*st));
+
+        if (!st)
+          {
+             ERR("Failed to allocate memory for icon!");
+             continue;
+          }
+
         evas_object_geometry_get(o, &st->start_x, &st->start_y, &st->start_w, &st->start_h);
         evas_object_show(o);
         st->o = o;