Skip to content

Commit b78a2e2

Browse files
committed
[nrf fromlist] modules: hostap: Fix memory leak of network
In "connect" all networks are removed and new network is always added, but in disconnect the network isn't deleted, so, the memory is unnecessarily held till next connect. This is not exactly a leak, but if someone profiles using "kernel heap" then this can be construed as a leak. Fix this by removing network during the disconnection (for now "all") so that the memory can be used by someone else. Upstream PR: zephyrproject-rtos/zephyr#79739 Signed-off-by: Chaitanya Tata <[email protected]> (cherry picked from commit a51b71dca9a6f402a2fcc93b5272e5a4b4251a46)
1 parent 633d4ad commit b78a2e2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

modules/hostap/src/supp_api.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,10 @@ static int wpas_disconnect_network(const struct device *dev, int cur_mode)
840840
wifi_mgmt_raise_disconnect_complete_event(iface, ret);
841841
}
842842

843+
if (!wpa_cli_cmd_v("remove_network all")) {
844+
wpa_printf(MSG_ERROR, "Failed to remove all networks");
845+
}
846+
843847
return ret;
844848
}
845849

0 commit comments

Comments
 (0)