diff options
author | James Prestwood <prestwoj@gmail.com> | 2020-03-16 12:22:39 -0700 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2020-03-13 23:52:26 -0500 |
commit | 37886066d8c6ab1e64ae158f1b6aa698b057f290 (patch) | |
tree | b4f7ea70069b94432e73f02017874493d287280b | |
parent | af2147fbdefc6293f47b0239c03425237103c5a7 (diff) | |
download | iwd-37886066d8c6ab1e64ae158f1b6aa698b057f290.tar.gz |
test-runner: fix crash if ofono is not installed
The goto was jumping to a label which freed the wiphy list which
had not yet been initialized. This also fixes another similar issue
if chdir fails (in this case tmpfs_extra_stuff would get freed
before being allocated).
-rw-r--r-- | tools/test-runner.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/test-runner.c b/tools/test-runner.c index 804a1038b..42bd60e21 100644 --- a/tools/test-runner.c +++ b/tools/test-runner.c @@ -2073,7 +2073,7 @@ static void create_network_and_run_tests(void *data, void *user_data) if (chdir(config_dir_path) < 0) { l_error("Failed to change to test directory: %s", strerror(errno)); - goto exit_hwsim; + goto free_hw_settings; } tmpfs_extra_stuff = @@ -2097,7 +2097,7 @@ static void create_network_and_run_tests(void *data, void *user_data) if (!ofono_found || !phonesim_found) { l_info("ofono or phonesim not found, skipping"); - goto exit_hwsim; + goto free_tmpfs_extra; } ofono_req = true; @@ -2268,7 +2268,6 @@ exit_hostapd: remove_abs_paths: remove_absolute_path_dirs(tmpfs_extra_stuff); -exit_hwsim: /* * If running in hwsim mode, we want to completely free/destroy the * wiphy list since it will be re-populated on the next test. For the @@ -2280,8 +2279,10 @@ exit_hwsim: else l_queue_foreach(wiphy_list, wiphy_reset, NULL); - l_settings_free(hw_settings); +free_tmpfs_extra: l_strfreev(tmpfs_extra_stuff); +free_hw_settings: + l_settings_free(hw_settings); } struct stat_totals { |