edje_cc - use mem_alloc to fail and exit if alloc fails and fix err out
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Wed, 17 May 2017 05:53:22 +0000 (14:53 +0900)
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>
Wed, 17 May 2017 06:04:01 +0000 (15:04 +0900)
PVS sudio thought this was odd and it was a bit. not a real issue as a
mem alloc failure herw would still be fatal and simply a crash... as
opposed to a clean "out of mem" and fatal exit then...

error out eally was not finding originally allocated color and the
malloc should have been a mem_alloc() that guarantees a valid memory
return (or termintion of the process).

@fix

src/bin/edje/edje_cc_handlers.c

index 798857b..bbffeca 100644 (file)
@@ -8034,7 +8034,7 @@ _copied_map_colors_get(Edje_Part_Description_Common *parent)
    int i;
 
    if (parent->map.colors_count == 0) return NULL;
-   colors = malloc(sizeof(Edje_Map_Color *) * parent->map.colors_count);
+   colors = mem_alloc(sizeof(Edje_Map_Color *) * parent->map.colors_count);
 
    for (i = 0; i < (int)parent->map.colors_count; i++)
      {
@@ -8043,7 +8043,7 @@ _copied_map_colors_get(Edje_Part_Description_Common *parent)
         Edje_Map_Color *c = mem_alloc(SZ(Edje_Map_Color));
         if (!color)
           {
-             ERR("not enough memory");
+             ERR("Could not find allocated source when copying map colors");
              exit(-1);
              return NULL;
           }