Parcourir la source

wpa_cli: Fix memory leak when tracking networks

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

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Andrei Otcheretianski il y a 10 ans
Parent
commit
74197e0adf
1 fichiers modifiés avec 4 ajouts et 2 suppressions
  1. 4 2
      wpa_supplicant/wpa_cli.c

+ 4 - 2
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;
 }