From b1f1cd14c21948ba8a6b629ff8c686f68f891897 Mon Sep 17 00:00:00 2001 From: Alok Mishra Date: Mon, 2 Jan 2017 15:14:13 +0900 Subject: [PATCH] elm_config: fix for dereferencing after comparing to NULL Summary: arr has been checked earlier so as to avoid when it is NULL. If there is a possibility of being NULL earlier then it should be checked even when freeing. So added the NULL check before free. @fix Reviewers: singh.amitesh, bu5hm4n, tasn, cedric, raster, atulfokk, hyunseok, minkyu, Hermet, jpeg Reviewed By: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4537 --- src/lib/elementary/elm_config.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/lib/elementary/elm_config.c b/src/lib/elementary/elm_config.c index 0af9d58b90..c6cb7b5374 100644 --- a/src/lib/elementary/elm_config.c +++ b/src/lib/elementary/elm_config.c @@ -4191,8 +4191,11 @@ _elm_config_accel_preference_parse(const char *pref, Eina_Stringshare **accel, DBG("gl depth: %d", *gl_depth); DBG("gl stencil: %d", *gl_stencil); DBG("gl msaa: %d", *gl_msaa); - free(arr[0]); - free(arr); + if (arr) + { + free(arr[0]); + free(arr); + } return is_hw_accel; }