qca-wifi: cleanup buffers for incomplete amsdu

if last_msdu is not received  then allocated
mpdu_nbuf and mpdu_q is not freed,

This change frees the buffers in last_msdu not seen case.

Change-Id: Icaaa6e227f3ea1d314c6d15a9f76c2f622d5d93f
CRs-Fixed: 2643848
diff --git a/dp/wifi3.0/dp_tx_capture.c b/dp/wifi3.0/dp_tx_capture.c
index 4d6db37..4d3eab8 100644
--- a/dp/wifi3.0/dp_tx_capture.c
+++ b/dp/wifi3.0/dp_tx_capture.c
@@ -1376,21 +1376,6 @@
 			/* pull ethernet header from first MSDU alone */
 			qdf_nbuf_pull_head(curr_nbuf,
 					   sizeof(qdf_ether_header_t));
-			mpdu_nbuf = qdf_nbuf_alloc(pdev->soc->osdev,
-						   MAX_MONITOR_HEADER,
-						   MAX_MONITOR_HEADER,
-						   4, FALSE);
-
-			if (!mpdu_nbuf) {
-				QDF_TRACE(QDF_MODULE_ID_TX_CAPTURE,
-					  QDF_TRACE_LEVEL_FATAL,
-					  "MPDU head allocation failed !!!");
-				goto free_ppdu_desc_mpdu_q;
-			}
-
-			dp_tx_update_80211_hdr(pdev, peer,
-					       ppdu_desc, mpdu_nbuf,
-					       ether_type, eh->ether_shost);
 
 			/* update first buffer to previous buffer */
 			prev_nbuf = curr_nbuf;
@@ -1433,6 +1418,23 @@
 		frag_list_sum_len += qdf_nbuf_len(curr_nbuf);
 
 		if (last_msdu) {
+
+			mpdu_nbuf = qdf_nbuf_alloc(pdev->soc->osdev,
+						   MAX_MONITOR_HEADER,
+						   MAX_MONITOR_HEADER,
+						   4, FALSE);
+
+			if (!mpdu_nbuf) {
+				QDF_TRACE(QDF_MODULE_ID_TX_CAPTURE,
+					  QDF_TRACE_LEVEL_FATAL,
+					  "MPDU head allocation failed !!!");
+				goto free_ppdu_desc_mpdu_q;
+			}
+
+			dp_tx_update_80211_hdr(pdev, peer,
+					       ppdu_desc, mpdu_nbuf,
+					       ether_type, eh->ether_shost);
+
 			/*
 			 * first nbuf will hold list of msdu
 			 * stored in prev_nbuf
@@ -1459,6 +1461,9 @@
 			QDF_TRACE(QDF_MODULE_ID_TX_CAPTURE,
 				  QDF_TRACE_LEVEL_FATAL,
 				  "!!!! WAITING for msdu but list empty !!!!");
+
+			/* for incomplete list, free up the queue */
+			goto free_ppdu_desc_mpdu_q;
 		}
 
 		continue;