handle surf alloc failures.
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 19 May 2011 09:28:43 +0000 (09:28 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 19 May 2011 09:28:43 +0000 (09:28 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@59524 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/modules/loaders/psd/evas_image_load_psd.c

index 1c7d780..bda696b 100644 (file)
@@ -594,6 +594,11 @@ read_psd_grey(Image_Entry *ie, PSD_Header *head, FILE * f, int *error)
 
    evas_cache_image_surface_alloc(ie, ie->w, ie->h);
    surface = evas_cache_image_pixels(ie);
+   if (!surface)
+     {
+        *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
+        goto cleanup_error;
+     }
 
    if (!psd_get_data(ie, head, f, surface, compressed, error))
      goto cleanup_error;
@@ -654,6 +659,11 @@ read_psd_indexed(Image_Entry *ie, PSD_Header *head, FILE * f, int *error)
 
    evas_cache_image_surface_alloc(ie, ie->w, ie->h);
    surface = evas_cache_image_pixels(ie);
+   if (!surface)
+     {
+        *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
+        return EINA_FALSE;
+     }
 
    if (!psd_get_data(ie, head, f, surface, compressed, error))
      return EINA_FALSE;
@@ -707,6 +717,11 @@ read_psd_rgb(Image_Entry *ie, PSD_Header *head, FILE *f, int *error)
 
    evas_cache_image_surface_alloc(ie, ie->w, ie->h);
    surface = evas_cache_image_pixels(ie);
+   if (!surface)
+     {
+        *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
+        goto cleanup_error;
+     }
 
    if (!psd_get_data(ie, head, f, surface, compressed, error))
      goto cleanup_error;
@@ -784,6 +799,11 @@ read_psd_cmyk(Image_Entry *ie, PSD_Header *head, FILE *f, int *error)
 
    evas_cache_image_surface_alloc(ie, ie->w, ie->h);
    surface = evas_cache_image_pixels(ie);
+   if (!surface)
+     {
+        *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
+        goto cleanup_error;
+     }
 
    if (!psd_get_data(ie, head, f, surface, compressed, error))
      goto cleanup_error;