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>
This commit is contained in:
parent
946ed13c98
commit
9c5fe742a2
1 changed files with 2 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue