From 10fb982ac01874fa273d67a91aa4e852485b86f1 Mon Sep 17 00:00:00 2001 From: Stefan Schmidt Date: Tue, 6 Dec 2016 10:49:10 +0100 Subject: [PATCH] evas: native_dmabuf: make sure we check for NULL before not after we dereference Same change as just done in evas_native_tbm in commit 38dbe932db5c12f66ff2e045ac74107e149c14da. --- .../engines/software_generic/evas_native_dmabuf.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/modules/evas/engines/software_generic/evas_native_dmabuf.c b/src/modules/evas/engines/software_generic/evas_native_dmabuf.c index e19db5b8dc..d85e352451 100644 --- a/src/modules/evas/engines/software_generic/evas_native_dmabuf.c +++ b/src/modules/evas/engines/software_generic/evas_native_dmabuf.c @@ -19,9 +19,10 @@ _native_bind_cb(void *image, int x EINA_UNUSED, int y EINA_UNUSED, int w EINA_UN struct dmabuf_attributes *a; int size; RGBA_Image *im = image; - Native *n = im->native.data; - if (!im || !n) return; + if (!im) return; + Native *n = im->native.data; + if (!n) return; if (n->ns.type != EVAS_NATIVE_SURFACE_WL_DMABUF) return; @@ -44,9 +45,10 @@ static void _native_unbind_cb(void *image) { RGBA_Image *im = image; - Native *n = im->native.data; - if (!im || !n) return; + if (!im) return; + Native *n = im->native.data; + if (!n) return; if (n->ns.type != EVAS_NATIVE_SURFACE_WL_DMABUF) return; } @@ -55,9 +57,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; if (im->image.data) munmap(n->ns_data.wl_surface_dmabuf.ptr,