Add NULL check before dereferencing pointer "ug_app_state" instead after it. 83/288883/1 accepted/tizen/unified/20230309.161429
authorAkash Kumar <akash1.kumar@samsung.com>
Fri, 24 Feb 2023 05:24:13 +0000 (10:54 +0530)
committerAkash Kumar <akash1.kumar@samsung.com>
Fri, 24 Feb 2023 05:24:13 +0000 (10:54 +0530)
Change-Id: I0124841f51fddc6d235aebc89159d7983dafce92
Signed-off-by: Akash Kumar <akash1.kumar@samsung.com>
ui-gadget/wifi-efl-UG.c

index ddbc140..57b6f78 100644 (file)
@@ -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);