From: Chris Michael Date: Thu, 5 Oct 2017 13:54:03 +0000 (-0400) Subject: evas-gl-image: Fix dereference after null check X-Git-Tag: submit/sandbox/upgrade/efl120/20180319.053334~2374 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7b7161ea13d7d33c6183107a4da5203eddf74217;p=platform%2Fupstream%2Fefl.git evas-gl-image: Fix dereference after null check Coverity reports passing a null pointer 'im->gc' to evas_gl_common_context_flush which directly dereferences it, so lets be sure that 'im->gc' is valid before passing it to context_flush Fixes CID1374273 @fix Signed-off-by: Chris Michael --- diff --git a/src/modules/evas/engines/gl_common/evas_gl_image.c b/src/modules/evas/engines/gl_common/evas_gl_image.c index ca305cf..f4ea8e1 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_image.c +++ b/src/modules/evas/engines/gl_common/evas_gl_image.c @@ -766,7 +766,7 @@ evas_gl_common_image_cache_flush(Evas_Engine_GL_Context *gc) EAPI void evas_gl_common_image_free(Evas_GL_Image *im) { - if (!im) return ; + if (!im) return; im->references--; if (im->references > 0) return; @@ -781,7 +781,8 @@ evas_gl_common_image_free(Evas_GL_Image *im) im->fglyph->ext_dat_free = NULL; } - evas_gl_common_context_flush(im->gc); + if (im->gc) + evas_gl_common_context_flush(im->gc); evas_gl_common_image_preload_unwatch(im);