Fix PASSED_TO_PROC_AFTER_FREE.EX 81/319081/1 accepted/tizen_9.0_unified accepted/tizen_unified accepted/tizen_unified_toolchain accepted/tizen_unified_x accepted/tizen_unified_x_asan tizen tizen_9.0 accepted/tizen/9.0/unified/20241030.233541 accepted/tizen/unified/20241017.114727 accepted/tizen/unified/toolchain/20241022.122721 accepted/tizen/unified/toolchain/20241022.123118 accepted/tizen/unified/x/20241017.170418 accepted/tizen/unified/x/asan/20241022.113609 tizen_9.0_m2_release
authorJaehyun Kim <jeik01.kim@samsung.com>
Tue, 15 Oct 2024 03:17:17 +0000 (12:17 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Tue, 15 Oct 2024 03:17:17 +0000 (12:17 +0900)
Pointer 'scan_data' and 'scan_data_local' are passed to print_scan_freqs()
after the referenced memory was deallocated in set_band_freqs().

Change-Id: I683bb5ec2874716f94cc50c9a8f7b8149bd368db
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
gsupplicant/supplicant.c

index 1852c45..8c5cebf 100755 (executable)
@@ -6663,16 +6663,10 @@ static void set_band_freqs(GSupplicantScanParams *scan_data)
 
        switch (wifi_band_selection_method) {
        case WIFI_BAND_SELECTION_2_4GHZ:
-               if (!set_band_freqs_2_4ghz(scan_data)) {
-                       g_free(scan_data);
-                       return;
-               }
+               set_band_freqs_2_4ghz(scan_data);
                break;
        case WIFI_BAND_SELECTION_5GHZ:
-               if (!set_band_freqs_5ghz(scan_data)) {
-                       g_free(scan_data);
-                       return;
-               }
+               set_band_freqs_5ghz(scan_data);
                break;
        case WIFI_BAND_SELECTION_6GHZ:
                /* Currently not supported */
@@ -6718,6 +6712,12 @@ int g_supplicant_interface_scan(GSupplicantInterface *interface,
                } else {
                        set_band_freqs(scan_data_local);
                        print_scan_freqs(scan_data_local);
+
+                       if (scan_data_local->num_freqs == 0) {
+                               g_free(scan_data_local);
+                               scan_data_local = NULL;
+                       }
+
                        data->scan_params = scan_data_local;
                }
        }