stefan pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=7d93a1d45f858d06815887295a8f1a40951b6da9

commit 7d93a1d45f858d06815887295a8f1a40951b6da9
Author: Stefan Schmidt <ste...@osg.samsung.com>
Date:   Tue Dec 6 10:42:42 2016 +0100

    evas: native_tbm: make sure we check for NULL before not after we 
dereference
    
    Using *im and dereferencing it before doing the actual NULL check does not 
make
    much sense. I kept the checks as they have been there before so the intent 
was
    probably that they could be NULL and should be checked.
    
    CID: 1270030, 1270029, 1270028
---
 src/modules/evas/engines/software_generic/evas_native_tbm.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/modules/evas/engines/software_generic/evas_native_tbm.c 
b/src/modules/evas/engines/software_generic/evas_native_tbm.c
index 7cb3595..696a728 100644
--- a/src/modules/evas/engines/software_generic/evas_native_tbm.c
+++ b/src/modules/evas/engines/software_generic/evas_native_tbm.c
@@ -210,11 +210,12 @@ static void
 _native_bind_cb(void *image, int x EINA_UNUSED, int y EINA_UNUSED, int w 
EINA_UNUSED, int h EINA_UNUSED)
 {
    RGBA_Image *im = image;
-   Native *n = im->native.data;
    tbm_surface_info_s info;
    tbm_surface_h tbm_surf;
 
-   if (!im || !n) return;
+   if (!im) return;
+   Native *n = im->native.data;
+   if (!n) return;
    if (n->ns.type != EVAS_NATIVE_SURFACE_TBM)
      return;
 
@@ -229,10 +230,11 @@ static void
 _native_unbind_cb(void *image)
 {
    RGBA_Image *im = image;
-   Native *n = im->native.data;
    tbm_surface_h tbm_surf;
 
-   if (!im || !n) return;
+   if (!im) return;
+   Native *n = im->native.data;
+   if (!n) return;
    if (n->ns.type != EVAS_NATIVE_SURFACE_TBM)
      return;
 
@@ -244,9 +246,9 @@ static void
 _native_free_cb(void *image)
 {
    RGBA_Image *im = image;
-   Native *n = im->native.data;
 
    if (!im) return;
+   Native *n = im->native.data;
 
    im->native.data        = NULL;
    im->native.func.bind   = NULL;

-- 


Reply via email to