[PATCH] wpa_supplicant: Free config only if it was allocated in same call

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From 15cce845a258b4c8040f6854f664761654a9f1cb Mon Sep 17 00:00:00 2001
From: Dmitry Shmidt <dimitrysh@xxxxxxxxxx>
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@xxxxxxxxxxxxxxxxxxx

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@xxxxxxxxxx>
---
 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


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux