Procházet zdrojové kódy

qcacld-3.0: Free the allocated beacon memory in start_bss failure

As part of start_ap new beacon memory is allocated and filled with
the parameters sent by the upper layer. If there is any failure
during the start the bss, the memory is not freed resulting in
the leak.

Free the allocated beacon memory if there is any failure in starting
the bss.

Change-Id: Idc263ffbb352e56d65d397b200facb23b7ab207c
CRs-fixed: 2033325
Arunk Khandavalli před 7 roky
rodič
revize
bbc301f619
1 změnil soubory, kde provedl 14 přidání a 0 odebrání
  1. 14 0
      core/hdd/src/wlan_hdd_hostapd.c

+ 14 - 0
core/hdd/src/wlan_hdd_hostapd.c

@@ -8978,6 +8978,12 @@ static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy,
 				&params->beacon,
 				params->ssid, params->ssid_len,
 				params->hidden_ssid, true, false);
+
+		if (status != 0) {
+			hdd_err("Error Start bss Failed");
+			goto err_start_bss;
+		}
+
 		/*
 		 * If Do_Not_Break_Stream enabled send avoid channel list
 		 * to application.
@@ -9003,6 +9009,14 @@ static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy,
 		}
 	}
 
+	goto success;
+
+err_start_bss:
+	if (pAdapter->sessionCtx.ap.beacon)
+		qdf_mem_free(pAdapter->sessionCtx.ap.beacon);
+	pAdapter->sessionCtx.ap.beacon = NULL;
+
+success:
 	EXIT();
 	return status;
 }