wlan: Fix memory leak in SENDACTIONFRAME command processing
Static source code analysis identified an issue in hdd_ioctl() where,
when processing the SENDACTIONFRAME command, the buffer returned by
hdd_parse_send_action_frame_data() is leaked. Update the code to free
the buffer when it is no longer needed.
Change-Id: I1684f02d497c848570ff238cafd80be03d30621c
CRs-fixed: 470188
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index 6512619..8570065 100644
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -1069,6 +1069,7 @@
{
VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s:STA is not associated to this AP!",__func__);
ret = -EINVAL;
+ vos_mem_free(buf);
goto exit;
}
@@ -1080,6 +1081,7 @@
"%s: channel(%d) is different from operating channel(%d)",
__func__, channel, pHddStaCtx->conn_info.operationChannel);
ret = -EINVAL;
+ vos_mem_free(buf);
goto exit;
}
chan.center_freq = sme_ChnToFreq(channel);
@@ -1090,6 +1092,7 @@
{
VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s:memory allocation failed",__func__);
ret = -ENOMEM;
+ vos_mem_free(buf);
goto exit;
}
vos_mem_zero(finalBuf, finalLen);
@@ -1114,6 +1117,9 @@
/* Fill received buffer from 24th address */
vos_mem_copy(finalBuf + 24, buf, bufLen);
+ /* done with the parsed buffer */
+ vos_mem_free(buf);
+
wlan_hdd_action( NULL, dev, &chan, 0, NL80211_CHAN_HT20,
1, dwellTime, finalBuf, finalLen, 1,
1, &cookie );