[PATCH v3] plugins/wifi: Fix GSupplicantInterface socket leak during teardown

Doemela <[email protected]>
Newsgroups dev.linux.lists.connman
Message-ID <[email protected]>
---
Changes in v3:
  - Fixed the truncation error at line 10 that broke the v2 patch.
  - Switched to git send-email to avoid webmail formatting bugs.
  - Sorry about the formatting noise; it has been a while since I used a mailing list!

Changes in v2:
  - Corrected resource cancellation logic inside GSupplicantInterface.

 plugins/wifi.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/plugins/wifi.c b/plugins/wifi.c
index 9ce7b5a3..ce09b556 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -2740,19 +2740,17 @@ static void interface_removed(GSupplicantInterface *interface)
 	DBG("ifname %s", ifname);
 
 	wifi = g_supplicant_interface_get_data(interface);
-
 	if (wifi)
 		wifi->interface = NULL;
 
 	if (wifi && wifi->tethering)
 		return;
 
-	if (!wifi || !wifi->device) {
-		DBG("wifi interface already removed");
-		return;
-	}
+	if (wifi != NULL && wifi->device != NULL)
+		connman_device_set_powered(wifi->device, FALSE);
 
-	connman_device_set_powered(wifi->device, false);
+	g_supplicant_interface_set_data(interface, NULL);
+	g_supplicant_interface_cancel(interface);
 
 	check_p2p_technology();
 }
-- 
2.47.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.