Commit f54e994c authored by Colin Ian King's avatar Colin Ian King Committed by Greg Kroah-Hartman

staging: wilc1000: fix a couple of memory leaks

The ENOMEM error return paths are not free'ing allocated memory
resulting in a memory leak of allocated structures. Perform the
required kfree to fix the memory leaks.

Issue discovered with static analysis using CoverityScan
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2e115901
...@@ -338,8 +338,10 @@ s32 wilc_parse_network_info(u8 *msg_buffer, ...@@ -338,8 +338,10 @@ s32 wilc_parse_network_info(u8 *msg_buffer,
if (ies_len > 0) { if (ies_len > 0) {
network_info->ies = kmemdup(ies, ies_len, GFP_KERNEL); network_info->ies = kmemdup(ies, ies_len, GFP_KERNEL);
if (!network_info->ies) if (!network_info->ies) {
kfree(network_info);
return -ENOMEM; return -ENOMEM;
}
} }
network_info->ies_len = ies_len; network_info->ies_len = ies_len;
} }
...@@ -373,8 +375,10 @@ s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len, ...@@ -373,8 +375,10 @@ s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
AID_LEN); AID_LEN);
connect_resp_info->ies = kmemdup(ies, ies_len, GFP_KERNEL); connect_resp_info->ies = kmemdup(ies, ies_len, GFP_KERNEL);
if (!connect_resp_info->ies) if (!connect_resp_info->ies) {
kfree(connect_resp_info);
return -ENOMEM; return -ENOMEM;
}
connect_resp_info->ies_len = ies_len; connect_resp_info->ies_len = ies_len;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment