Message ID | 001a113d0fa8bb8aa705641bc3b5@google.com |
---|---|
State | Accepted |
Headers | show |
Series | wpa_supplicant: Free config only if it was allocated in same call | expand |
On Thu, Feb 01, 2018 at 12:34:54AM +0000, dimitrysh@google.com wrote: > If option -I:config points to non-existing file, there > is no need to free the previousely allocated config. Thanks, applied (and also fixed the case where the -I config file exists, but parsing it fails).
diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c index 6f2161ea6..bf0ba173c 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; }