[PATCH] wpa_supplicant: Free config only if it was allocated in same call
dimitrysh at google.com
dimitrysh at google.com
Wed Jan 31 16:34:54 PST 2018
From 15cce845a258b4c8040f6854f664761654a9f1cb Mon Sep 17 00:00:00 2001
From: Dmitry Shmidt <dimitrysh at google.com>
Date: Wed, 31 Jan 2018 16:27:46 -0800
Subject: [PATCH] wpa_supplicant: Free config only if it was allocated in
same
call
To: hostap at lists.infradead.org
If option -I:config points to non-existing file, there
is no need to free the previousely allocated config.
Signed-off-by: Dmitry Shmidt <dimitrysh at google.com>
---
wpa_supplicant/config_file.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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;
}
--
2.16.0.rc1.238.g530d649a79-goog
More information about the Hostap
mailing list