From 6214537eab77d246ad9093e74387912f7bd1f2a3 Mon Sep 17 00:00:00 2001 From: Akash Kumar Date: Fri, 24 Feb 2023 10:54:13 +0530 Subject: [PATCH] Add NULL check before dereferencing pointer "ug_app_state" instead after it. Change-Id: I0124841f51fddc6d235aebc89159d7983dafce92 Signed-off-by: Akash Kumar --- ui-gadget/wifi-efl-UG.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ui-gadget/wifi-efl-UG.c b/ui-gadget/wifi-efl-UG.c index ddbc140..57b6f78 100644 --- a/ui-gadget/wifi-efl-UG.c +++ b/ui-gadget/wifi-efl-UG.c @@ -303,7 +303,7 @@ static void on_destroy(ui_gadget_h ug, app_control_h app_control, void *priv) common_util_set_system_registry(VCONFKEY_WIFI_UG_RUN_STATE, VCONFKEY_WIFI_UG_RUN_STATE_OFF); - if (!ug || !priv) { + if (!ug || !priv || !ug_app_state) { __COMMON_FUNC_EXIT__; return; } @@ -353,10 +353,8 @@ static void on_destroy(ui_gadget_h ug, app_control_h app_control, void *priv) ug_app_state->lbutton_setup_wizard_prev = NULL; } - if (ug_app_state != NULL) { - g_free(ug_app_state); - ug_app_state = NULL; - } + g_free(ug_app_state); + ug_app_state = NULL; if (ugd->base != NULL) { evas_object_del(ugd->base); -- 2.7.4