diff options
| author | yeshwanth sriram guntuka <ysriramg@codeaurora.org> | 2017-07-18 17:25:32 +0530 |
|---|---|---|
| committer | snandini <snandini@codeaurora.org> | 2017-08-24 04:32:02 -0700 |
| commit | e3fba37a7c22a5e2239ee71b034680a0f9df3689 (patch) | |
| tree | c55ba234c193b8067f8d6e5d77552fd870cd9a02 | |
| parent | f539d63c9d0280885ed5d02e0a193ada1cc972ca (diff) | |
qcacld-3.0: Fix memory allocation error
Allocation of memory for assoc resp fails
when frame length is zero and error message
is displayed.
Fix is to allocate memory only when frame length
is greater than zero.
Change-Id: I6c3a457b7eb9d49fa67bee7570594dd81c2eb3d7
CRs-Fixed: 2096171
| -rw-r--r-- | core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c b/core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c index 7326c223ff5e..516e59b1058c 100644 --- a/core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c +++ b/core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c @@ -641,17 +641,19 @@ lim_process_assoc_rsp_frame(tpAniSirGlobal mac_ctx, session_entry->assocRspLen = 0; } - session_entry->assocRsp = qdf_mem_malloc(frame_len); - if (NULL == session_entry->assocRsp) { - pe_err("Unable to allocate memory for assoc res,len: %d", - frame_len); - } else { - /* - * Store the Assoc response. This is sent - * to csr/hdd in join cnf response. - */ - qdf_mem_copy(session_entry->assocRsp, body, frame_len); - session_entry->assocRspLen = frame_len; + if (frame_len) { + session_entry->assocRsp = qdf_mem_malloc(frame_len); + if (NULL == session_entry->assocRsp) { + pe_err("Unable to allocate memory for assoc res,len: %d", + frame_len); + } else { + /* + * Store the Assoc response. This is sent + * to csr/hdd in join cnf response. + */ + qdf_mem_copy(session_entry->assocRsp, body, frame_len); + session_entry->assocRspLen = frame_len; + } } lim_update_ric_data(mac_ctx, session_entry, assoc_rsp); |
