P2P: Deinit GO group data before global P2P deinit
authorJouni Malinen <jouni.malinen@atheros.com>
Thu, 5 Aug 2010 02:13:00 +0000 (19:13 -0700)
committerJouni Malinen <j@w1.fi>
Thu, 9 Sep 2010 14:17:23 +0000 (07:17 -0700)
This avoids issues with using freed memory in p2p_group_deinit().

wpa_supplicant/p2p_supplicant.c

index 71b08ad..b9b18bb 100644 (file)
@@ -2268,6 +2268,15 @@ void wpas_p2p_deinit_global(struct wpa_global *global)
                os_free(ifname);
        }
 
+       /*
+        * Deinit GO data on any possibly remaining interface (if main
+        * interface is used as GO).
+        */
+       for (wpa_s = global->ifaces; wpa_s; wpa_s = wpa_s->next) {
+               if (wpa_s->ap_iface)
+                       wpas_p2p_group_deinit(wpa_s);
+       }
+
        p2p_deinit(global->p2p);
        global->p2p = NULL;
 }