From ef759b63951c0fffb61cf8366c0aff884301b5df Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Thu, 22 Sep 2016 20:45:04 +0900 Subject: [PATCH] evas: Prevent crashes in case of error SEGV would happen if the cache was NULL, as the error pointer was also NULL in some cases (root cause for cache == NULL not quite known, happens in elm_suite with CK_FORK=no). Note: simply adding evas_common_init() to evas_init() leads to a whole new set of issues with CK_FORK=no elm_suite - not good. --- src/lib/evas/cache/evas_cache_image.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/lib/evas/cache/evas_cache_image.c b/src/lib/evas/cache/evas_cache_image.c index a0c6a65fcd..7dba180db8 100644 --- a/src/lib/evas/cache/evas_cache_image.c +++ b/src/lib/evas/cache/evas_cache_image.c @@ -1066,6 +1066,7 @@ evas_cache_image_copied_data(Evas_Cache_Image *cache, DATA32 *image_data, int alpha, Evas_Colorspace cspace) { + int err; Image_Entry *im; if ((cspace == EVAS_COLORSPACE_YCBCR422P601_PL) || @@ -1073,7 +1074,7 @@ evas_cache_image_copied_data(Evas_Cache_Image *cache, (cspace == EVAS_COLORSPACE_YCBCR422601_PL)) w &= ~0x1; - im = _evas_cache_image_entry_new(cache, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + im = _evas_cache_image_entry_new(cache, NULL, NULL, NULL, NULL, NULL, NULL, &err); if (!im) return NULL; im->space = cspace; im->flags.alpha = alpha; @@ -1093,6 +1094,7 @@ EAPI Image_Entry * evas_cache_image_data(Evas_Cache_Image *cache, unsigned int w, unsigned int h, DATA32 *image_data, int alpha, Evas_Colorspace cspace) { + int err; Image_Entry *im; if ((cspace == EVAS_COLORSPACE_YCBCR422P601_PL) || @@ -1100,7 +1102,7 @@ evas_cache_image_data(Evas_Cache_Image *cache, unsigned int w, unsigned int h, (cspace == EVAS_COLORSPACE_YCBCR422601_PL)) w &= ~0x1; - im = _evas_cache_image_entry_new(cache, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + im = _evas_cache_image_entry_new(cache, NULL, NULL, NULL, NULL, NULL, NULL, &err); if (!im) return NULL; im->w = w; im->h = h; @@ -1389,9 +1391,10 @@ evas_cache_image_flush(Evas_Cache_Image *cache) EAPI Image_Entry * evas_cache_image_empty(Evas_Cache_Image *cache) { + int err; Image_Entry *im; - im = _evas_cache_image_entry_new(cache, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + im = _evas_cache_image_entry_new(cache, NULL, NULL, NULL, NULL, NULL, NULL, &err); if (!im) return NULL; im->references = 1; return im;