aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/config_file.c
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2018-02-01 00:34:54 (GMT)
committerJouni Malinen <j@w1.fi>2018-02-04 10:13:12 (GMT)
commit9c5fe742a25d2361b49051aef5b1ed0083494b6c (patch)
treefca22105f56b30a54133454f44d951fce9ffedc4 /wpa_supplicant/config_file.c
parent946ed13c98278457b7cbade88521dbad09513324 (diff)
downloadhostap-9c5fe742a25d2361b49051aef5b1ed0083494b6c.zip
hostap-9c5fe742a25d2361b49051aef5b1ed0083494b6c.tar.gz
hostap-9c5fe742a25d2361b49051aef5b1ed0083494b6c.tar.bz2
wpa_supplicant: Free config only if it was allocated in same call
If option -I:config points to a non-existing file, the the previously allocated config must not be freed. Avoid use of freed memory in such an error case by skipping the incorrect freeing operation. Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Diffstat (limited to 'wpa_supplicant/config_file.c')
-rw-r--r--wpa_supplicant/config_file.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c
index 6f2161e..bf0ba17 100644
--- a/wpa_supplicant/config_file.c
+++ b/wpa_supplicant/config_file.c
@@ -397,7 +397,8 @@ struct wpa_config * wpa_config_read(const char *name, struct wpa_config *cfgp)
if (f == NULL) {
wpa_printf(MSG_ERROR, "Failed to open config file '%s', "
"error: %s", name, strerror(errno));
- os_free(config);
+ if (config != cfgp)
+ os_free(config);
return NULL;
}