Fix svace issues (PASSED_TO_PROC_AFTER_FREE) 27/253327/1 accepted/tizen/unified/20210209.124341 submit/tizen/20210209.032013
authorCheoleun Moon <chleun.moon@samsung.com>
Tue, 9 Feb 2021 01:53:29 +0000 (10:53 +0900)
committerCheoleun Moon <chleun.moon@samsung.com>
Tue, 9 Feb 2021 01:53:36 +0000 (10:53 +0900)
Change-Id: I04291e7becbe78ed82a16a6fefbafb5c42a5b6b0

tool/wifi_mgr_tool.c

index 1b53892..19a46d4 100755 (executable)
@@ -260,6 +260,7 @@ static int _test_wifi_mgr_initialize(MManager *mm, struct menu_data *menu)
        } else {
                msg("[1] Failed to initialize wifi handle " LOG_RED "[%s]" LOG_END,
                        test_wifi_mgr_convert_error_to_string(ret));
+               return ret;
        }
 
        ret = wifi_manager_initialize(&g_wifi2_h);
@@ -283,21 +284,20 @@ static int _test_wifi_mgr_initialize(MManager *mm, struct menu_data *menu)
        } else {
                msg("[2] Failed to initialize wifi handle " LOG_RED "[%s]" LOG_END,
                        test_wifi_mgr_convert_error_to_string(ret));
+               return ret;
        }
 
+       ret = wifi_manager_is_activated(g_wifi_h, &state);
+       wifi_manager_get_network_interface_name(g_wifi_h, &if_name);
        if (ret == WIFI_MANAGER_ERROR_NONE) {
-               ret = wifi_manager_is_activated(g_wifi_h, &state);
-               wifi_manager_get_network_interface_name(g_wifi_h, &if_name);
-               if (ret == WIFI_MANAGER_ERROR_NONE) {
-                       g_device_state = state;
-                       msg("[1:%s] Wi-Fi device state " LOG_CYAN "[%s]" LOG_END, if_name,
+               g_device_state = state;
+               msg("[1:%s] Wi-Fi device state " LOG_CYAN "[%s]" LOG_END, if_name,
                                test_wifi_mgr_device_state_to_string(g_device_state));
-               } else {
-                       msg("[1] Failed to get Wi-Fi device state " LOG_RED "[%s]" LOG_END,
+       } else {
+               msg("[1] Failed to get Wi-Fi device state " LOG_RED "[%s]" LOG_END,
                                test_wifi_mgr_convert_error_to_string(ret));
-               }
-               FREE(if_name);
        }
+       FREE(if_name);
 
        return ret;
 }
@@ -420,6 +420,7 @@ static int _test_wifi_mgr_initialize_with_ifname(MManager *mm, struct menu_data
        } else {
                msg("[1] Failed to initialize wifi handle " LOG_RED "[%s]" LOG_END,
                        test_wifi_mgr_convert_error_to_string(ret));
+               return ret;
        }
 
        ret = wifi_manager_initialize_with_interface_name(&g_wifi2_h, g_ifname);
@@ -443,21 +444,20 @@ static int _test_wifi_mgr_initialize_with_ifname(MManager *mm, struct menu_data
        } else {
                msg("[2] Failed to initialize wifi handle " LOG_RED "[%s]" LOG_END,
                        test_wifi_mgr_convert_error_to_string(ret));
+               return ret;
        }
 
+       ret = wifi_manager_is_activated(g_wifi_h, &state);
+       wifi_manager_get_network_interface_name(g_wifi_h, &if_name);
        if (ret == WIFI_MANAGER_ERROR_NONE) {
-               ret = wifi_manager_is_activated(g_wifi_h, &state);
-               wifi_manager_get_network_interface_name(g_wifi_h, &if_name);
-               if (ret == WIFI_MANAGER_ERROR_NONE) {
-                       g_device_state = state;
-                       msg("[1:%s] Wi-Fi device state " LOG_CYAN "[%s]" LOG_END, if_name,
+               g_device_state = state;
+               msg("[1:%s] Wi-Fi device state " LOG_CYAN "[%s]" LOG_END, if_name,
                                test_wifi_mgr_device_state_to_string(g_device_state));
-               } else {
-                       msg("[1] Failed to get Wi-Fi device state " LOG_RED "[%s]" LOG_END,
+       } else {
+               msg("[1] Failed to get Wi-Fi device state " LOG_RED "[%s]" LOG_END,
                                test_wifi_mgr_convert_error_to_string(ret));
-               }
-               FREE(if_name);
        }
+       FREE(if_name);
 
        return ret;
 }