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.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
This commit is contained in:
Chaitanya Tata 2024-10-12 02:45:02 +05:30 committed by Anas Nashif
parent 1174ea522f
commit be65de0d09
1 changed files with 4 additions and 0 deletions

View File

@ -1055,6 +1055,10 @@ out:
wifi_mgmt_raise_disconnect_complete_event(iface, ret);
}
if (!wpa_cli_cmd_v("remove_network all")) {
wpa_printf(MSG_ERROR, "Failed to remove all networks");
}
return ret;
}