elm_config: SVACE fix for dereferencing after comparing to NULL 89/88489/6
authorAlok Mishra <alok.mishra@samsung.com>
Mon, 19 Sep 2016 09:43:00 +0000 (15:13 +0530)
committerHermet Park <chuneon.park@samsung.com>
Thu, 22 Sep 2016 13:15:49 +0000 (06:15 -0700)
arr has been checked earlier so as to avoid when it is NULL.
SVACE complains 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

Change-Id: Idb82aa557e3b08890a1496200ee282db9552c1dd
Signed-off-by: Alok Mishra <alok.mishra@samsung.com>
src/lib/elm_config.c

index fcd91d6..946153d 100644 (file)
@@ -4046,8 +4046,11 @@ elm_config_accel_preference_set(const char *pref)
         DBG("gl depth: %d", _elm_config->gl_depth);
         DBG("gl stencil: %d", _elm_config->gl_stencil);
         DBG("gl msaa: %d", _elm_config->gl_msaa);
-        free(arr[0]);
-        free(arr);
+        if (arr)
+          {
+             free(arr[0]);
+             free(arr);
+          }
 
         if (is_hw_accel == EINA_FALSE)
           {