evas/cserve2: Fix error path in evas_cache2_image_writable()
authorJean-Philippe Andre <jp.andre@samsung.com>
Tue, 29 Oct 2013 06:12:58 +0000 (15:12 +0900)
committerJean-Philippe Andre <jp.andre@samsung.com>
Tue, 29 Oct 2013 06:12:58 +0000 (15:12 +0900)
Return NULL and check for nullity in the only calling function.

Fixes CID 1039461 (Logically dead code)

src/lib/evas/cache2/evas_cache2.c
src/modules/evas/engines/software_generic/evas_engine.c

index 35cceb6..d4b2b53 100644 (file)
@@ -1089,15 +1089,13 @@ evas_cache2_image_writable(Image_Entry *im)
                                         evas_cache2_image_pixels(im),
                                         im->flags.alpha, im->space);
    if (!im2)
-     goto on_error;
+     {
+        ERR("Could not create a copy of this image (%dx%d)", im->w, im->h);
+        return NULL;
+     }
 
    evas_cache2_image_close(im);
    return im2;
-
-on_error:
-   if (im2)
-     _evas_cache2_image_entry_delete(cache, im2);
-   return NULL;
 }
 
 EAPI Image_Entry *
index 57766ef..b3ab2ce 100644 (file)
@@ -1087,7 +1087,14 @@ eng_image_data_get(void *data EINA_UNUSED, void *image, int to_write, DATA32 **i
         if (err) *err = error;
 
         if (to_write)
-          im = (RGBA_Image *)evas_cache2_image_writable(&im->cache_entry);
+          {
+             im = (RGBA_Image *)evas_cache2_image_writable(&im->cache_entry);
+             if (!im)
+               {
+                  *image_data = NULL;
+                  return NULL;
+               }
+          }
      }
    else
 #endif