[PATCH v2] P2P: Disconnect P2P group on supplicant deinit
Jouni Malinen
j
Fri Apr 6 08:45:21 PDT 2012
On Tue, Apr 03, 2012 at 05:55:34PM -0700, nirav shah wrote:
> When a supplicant is deinited and shutting, adding code to disconnect
> from p2p_group. Found root causing the memory leak on variable
> dbus_groupobj_path on exiting supplicant.
> v2: Calling the function wpas_p2p_disconnect in wpas_p2p_deinit_global
> instead of wpa_supplicant_deinit_iface as it is a more appropriate location
Thanks! Applied with some changes:
> diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
> @@ -2478,7 +2478,7 @@ void wpas_p2p_deinit(struct wpa_supplicant *wpa_s)
> */
> void wpas_p2p_deinit_global(struct wpa_global *global)
> {
> - struct wpa_supplicant *wpa_s, *tmp;
> + struct wpa_supplicant *wpa_s, *p2p_interface;
I removed renaming of that variable to make the real changes easier to
see.
> - ifname = os_strdup(tmp->ifname);
> - type = wpas_p2p_if_type(tmp->p2p_group_interface);
> - wpa_supplicant_remove_iface(global, tmp, 0);
> + ifname = os_strdup(p2p_interface->ifname);
> + type = wpas_p2p_if_type(p2p_interface->p2p_group_interface);
> + /* Disconnect from the p2p group and deinit the interface */
> + wpas_p2p_disconnect(p2p_interface);
> +
> if (ifname)
> wpa_drv_if_remove(wpa_s, type, ifname);
The new code path will go through wpa_drv_if_remove() call in
wpas_p2p_group_delete(), so this one here will result in duplicated
attempt to remove the interface. I removed this to get rid of the
duplicated call.
--
Jouni Malinen PGP id EFC895FA
More information about the Hostap
mailing list