net: wireless: bcmdhd: Add proper cleaning for ap_info structure
authorDmitry Shmidt <dimitrysh@google.com>
Mon, 17 Oct 2011 00:12:29 +0000 (17:12 -0700)
committerDmitry Shmidt <dimitrysh@google.com>
Mon, 17 Oct 2011 00:19:16 +0000 (17:19 -0700)
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
drivers/net/wireless/bcmdhd/wl_cfg80211.c
drivers/net/wireless/bcmdhd/wl_cfgp2p.c

index 00cbfafb200c43ee7aed9e894f98d2574b35823a..2703784bbfd8b3e13f89c7693908259760ec2379 100644 (file)
@@ -3858,9 +3858,18 @@ wl_cfg80211_add_set_beacon(struct wiphy *wiphy, struct net_device *dev,
                                        return BCME_ERROR;
                                }
                                wl->ap_info->security_mode = true;
-                               kfree(wl->ap_info->rsn_ie);
-                               kfree(wl->ap_info->wpa_ie);
-                               kfree(wl->ap_info->wps_ie);
+                               if (wl->ap_info->rsn_ie) {
+                                       kfree(wl->ap_info->rsn_ie);
+                                       wl->ap_info->rsn_ie = NULL;
+                               }
+                               if (wl->ap_info->wpa_ie) {
+                                       kfree(wl->ap_info->wpa_ie);
+                                       wl->ap_info->wpa_ie = NULL;
+                               }
+                               if (wl->ap_info->wps_ie) {
+                                       kfree(wl->ap_info->wps_ie);
+                                       wl->ap_info->wps_ie = NULL;
+                               }
                                if (wpa_ie != NULL) {
                                        /* WPAIE */
                                        wl->ap_info->rsn_ie = NULL;
index 0251d822bc90f1915009b66f68deaa9ca40ad698..4ee6557e17dd838205abdf11b75ddde27d2e37d4 100644 (file)
@@ -112,6 +112,7 @@ wl_cfgp2p_deinit_priv(struct wl_priv *wl)
 {
        if (wl->p2p) {
                kfree(wl->p2p);
+               wl->p2p = NULL;
        }
        wl->p2p_supported = 0;
 }