hostap: Fix memory leak

The control interface is initialized on every interface add but only
de-initialized on WPA supplicant termination. This leaks all cleanups in
the control interface dei-init.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
diff --git a/modules/hostap/src/supp_main.c b/modules/hostap/src/supp_main.c
index 34b91b6..f9813b7 100644
--- a/modules/hostap/src/supp_main.c
+++ b/modules/hostap/src/supp_main.c
@@ -284,6 +284,8 @@
 		goto out;
 	}
 
+	zephyr_wpa_ctrl_deinit(wpa_s);
+
 	ret = zephyr_wpa_cli_global_cmd_v("interface_remove %s", ifname);
 	if (ret) {
 		LOG_ERR("Failed to remove interface %s", ifname);
@@ -509,7 +511,6 @@
 
 	eloop_unregister_read_sock(ctx->event_socketpair[0]);
 
-	zephyr_wpa_ctrl_deinit(ctx->supplicant);
 	zephyr_global_wpa_ctrl_deinit();
 
 	fst_global_deinit();