From e29da3ca694d62f9c0049e1d8d65f8f95e6bf455 Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Tue, 17 Nov 2015 10:00:19 -0500 Subject: [PATCH] evas-software-x11: Fix resource leak If we end up leaving evas_xlib_image_dri_native_set due to a failure to allocate memory, we should free the previously allocated Evas_DRI_Image so that we don't leak NB: Fixes Coverity CID1339782 @fix Signed-off-by: Chris Michael --- src/modules/evas/engines/software_x11/evas_xlib_dri_image.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/modules/evas/engines/software_x11/evas_xlib_dri_image.c b/src/modules/evas/engines/software_x11/evas_xlib_dri_image.c index 2c1c72c..0c0a0ab 100644 --- a/src/modules/evas/engines/software_x11/evas_xlib_dri_image.c +++ b/src/modules/evas/engines/software_x11/evas_xlib_dri_image.c @@ -588,7 +588,10 @@ evas_xlib_image_dri_native_set(void *data, void *image, void *native) n = calloc(1, sizeof(DRI_Native)); if (!n) - return NULL; + { + evas_xlib_image_dri_free(exim); + return NULL; + } memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface)); n->pixmap = pm; -- 2.7.4