From 5d1c8ad11de48ba5e449e83e1e5dcd844e9c35d1 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 23 Apr 2013 12:34:56 -0700 Subject: wpa_supplicant: fix memory leak in -I option handling Change-Id: I1b393d245d606882e7bb548135d1eab99a988a81 Signed-off-by: Dmitry Shmidt --- wpa_supplicant/config.h | 2 +- wpa_supplicant/main.c | 5 +++-- wpa_supplicant/wpa_supplicant.c | 3 +++ wpa_supplicant/wpa_supplicant_i.h | 5 +++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h index f83499c1..4a175ce9 100644 --- a/wpa_supplicant/config.h +++ b/wpa_supplicant/config.h @@ -912,7 +912,7 @@ int wpa_config_process_global(struct wpa_config *config, char *pos, int line); * wpa_config_read - Read and parse configuration database * @name: Name of the configuration (e.g., path and file name for the * configuration file) - * @cfgp: Pointer to previousely allocated configuration data + * @cfgp: Pointer to previously allocated configuration data or %NULL if none * Returns: Pointer to allocated configuration data or %NULL on failure * * This function reads configuration data, parses its contents, and allocates diff --git a/wpa_supplicant/main.c b/wpa_supplicant/main.c index c3ecbb3d..17446204 100644 --- a/wpa_supplicant/main.c +++ b/wpa_supplicant/main.c @@ -32,7 +32,8 @@ static void usage(void) " [-o] [-O] \\\n" " [-N -i -c [-C] " "[-D] \\\n" - " [-p] [-b] [-I]\n" + " [-p] [-b] [-I] " + "...]\n" "\n" "drivers:\n", wpa_supplicant_version, wpa_supplicant_license); @@ -50,7 +51,7 @@ static void usage(void) " -c = Configuration file\n" " -C = ctrl_interface parameter (only used if -c is not)\n" " -i = interface name\n" - " -I = additional Configuration file\n" + " -I = additional configuration file\n" " -d = increase debugging verbosity (-dd even more)\n" " -D = driver name (can be multiple drivers: nl80211,wext)\n" " -e = entropy file\n"); diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 398fca1a..44831735 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -399,6 +399,9 @@ static void wpa_supplicant_cleanup(struct wpa_supplicant *wpa_s) os_free(wpa_s->confname); wpa_s->confname = NULL; + os_free(wpa_s->confanother); + wpa_s->confanother = NULL; + wpa_sm_set_eapol(wpa_s->wpa, NULL); eapol_sm_deinit(wpa_s->eapol); wpa_s->eapol = NULL; diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index b47c11bc..f96b245b 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -56,9 +56,10 @@ struct wpa_interface { const char *confname; /** - * confanother - Additional Configuration name (file or profile) name + * confanother - Additional configuration name (file or profile) name * - * This can also be %NULL when a configuration file is not used. + * This can also be %NULL when the additional configuration file is not + * used. */ const char *confanother; -- cgit v1.2.3