From patchwork Wed Apr 4 00:55:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: nirav shah X-Patchwork-Id: 150573 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "maxx.shmoo.com", Issuer "CA Cert Signing Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id C0775B6EE7 for ; Wed, 4 Apr 2012 10:56:52 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 032D69C191; Tue, 3 Apr 2012 20:56:51 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pokixSpghFEt; Tue, 3 Apr 2012 20:56:50 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id C547A9C1DA; Tue, 3 Apr 2012 20:56:46 -0400 (EDT) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id B4EB09C1DA for ; Tue, 3 Apr 2012 20:56:45 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IsLcasFdbxgl for ; Tue, 3 Apr 2012 20:56:40 -0400 (EDT) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id BDE309C191 for ; Tue, 3 Apr 2012 20:56:40 -0400 (EDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 03 Apr 2012 17:56:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.67,351,1309762800"; d="scan'208";a="128417042" Received: from nirav-z68a-d3h-b3.hf.intel.com ([10.10.69.83]) by orsmga002.jf.intel.com with ESMTP; 03 Apr 2012 17:56:40 -0700 From: nirav shah To: hostap@lists.shmoo.com Subject: [PATCH v2] P2P: Disconnect P2P group on supplicant deinit Date: Tue, 3 Apr 2012 17:55:34 -0700 Message-Id: <1333500934-11338-1-git-send-email-nirav.j2.shah@intel.com> X-Mailer: git-send-email 1.7.4.1 X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com 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. Signed-hostap: Nirav Shah Signed-hostap: Angie Chinchilla --- 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 wpa_supplicant/p2p_supplicant.c | 24 ++++++++++++++---------- 1 files changed, 14 insertions(+), 10 deletions(-) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index f4e43a8..2fc2139 100644 --- 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; char *ifname; if (global->p2p == NULL) @@ -2492,17 +2492,21 @@ void wpas_p2p_deinit_global(struct wpa_global *global) wpa_s = wpa_s->next; while (wpa_s) { enum wpa_driver_if_type type; - tmp = global->ifaces; - while (tmp && - (tmp == wpa_s || - tmp->p2p_group_interface == NOT_P2P_GROUP_INTERFACE)) { - tmp = tmp->next; + p2p_interface = global->ifaces; + /* Find the next P2P group interface */ + while (p2p_interface && + (p2p_interface == wpa_s || + p2p_interface->p2p_group_interface + == NOT_P2P_GROUP_INTERFACE)) { + p2p_interface = p2p_interface->next; } - if (tmp == NULL) + if (p2p_interface == NULL) break; - 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); os_free(ifname);