evas-gl-common: Fix dereference after null check
authorChris Michael <cp.michael@samsung.com>
Thu, 5 Oct 2017 13:51:00 +0000 (09:51 -0400)
committerChris Michael <cp.michael@samsung.com>
Thu, 5 Oct 2017 13:51:00 +0000 (09:51 -0400)
Coverity reports that there may be a null pointer dereference here so
check that 'error' exists before trying to set it.

Fixes CID1374272

@fix

Signed-off-by: Chris Michael <cp.michael@samsung.com>
src/modules/evas/engines/gl_common/evas_gl_image.c

index fe8aa5b..ca305cf 100644 (file)
@@ -243,7 +243,7 @@ evas_gl_common_image_new_from_rgbaimage(Evas_Engine_GL_Context *gc, RGBA_Image *
        ((int)im_im->cache_entry.h > gc->shared->info.max_texture_size))
      {
         evas_cache_image_drop(&(im_im->cache_entry));
-        *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
+        if (error) *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
         return NULL;
      }
     */
@@ -259,7 +259,7 @@ evas_gl_common_image_new_from_rgbaimage(Evas_Engine_GL_Context *gc, RGBA_Image *
              gc->shared->images = eina_list_remove_list(gc->shared->images, l);
              gc->shared->images = eina_list_prepend(gc->shared->images, im);
              evas_gl_common_image_ref(im);
-             *error = EVAS_LOAD_ERROR_NONE;
+             if (error) *error = EVAS_LOAD_ERROR_NONE;
              return im;
           }
      }
@@ -273,7 +273,7 @@ evas_gl_common_image_new_from_rgbaimage(Evas_Engine_GL_Context *gc, RGBA_Image *
         else
 #endif
           evas_cache_image_drop(&(im_im->cache_entry));
-        *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
+        if (error) *error = EVAS_LOAD_ERROR_RESOURCE_ALLOCATION_FAILED;
         return NULL;
      }
    if (im_im->cache_entry.cspaces)