[PATCH 1/4] wpa_cli: Fix mem leak when tracking networks

Ilan Peer ilan.peer
Tue Apr 28 04:01:02 PDT 2015


From: Andrei Otcheretianski <andrei.otcheretianski at intel.com>

Fix memory leak introduced in
"32a097f: wpa_cli: Keep track of available networks"
by tracking networks only when in interactive mode.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski at intel.com>
---
 wpa_supplicant/wpa_cli.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c
index 6ec6bd3..c4f8669 100644
--- a/wpa_supplicant/wpa_cli.c
+++ b/wpa_supplicant/wpa_cli.c
@@ -1456,7 +1456,8 @@ static int wpa_cli_cmd_add_network(struct wpa_ctrl *ctrl, int argc,
 				   char *argv[])
 {
 	int res = wpa_ctrl_command(ctrl, "ADD_NETWORK");
-	update_networks(ctrl);
+	if (interactive)
+		update_networks(ctrl);
 	return res;
 }
 
@@ -1465,7 +1466,8 @@ static int wpa_cli_cmd_remove_network(struct wpa_ctrl *ctrl, int argc,
 				      char *argv[])
 {
 	int res = wpa_cli_cmd(ctrl, "REMOVE_NETWORK", 1, argc, argv);
-	update_networks(ctrl);
+	if (interactive)
+		update_networks(ctrl);
 	return res;
 }
 
-- 
1.9.1




More information about the Hostap mailing list