瀏覽代碼

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 7 年之前
父節點
當前提交
bbc301f619
共有 1 個文件被更改,包括 14 次插入0 次删除
  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;
 }