aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2016-03-21 18:42:11 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-03-22 22:27:36 -0400
commitf54e994c2900ac5f0d4e12faf430d96e29f389c2 (patch)
treeeac3f04d3c8228432474a256a2e6e7f20a871894
parent2e11590171683c6b12193fe4b0ede1e6201b7f45 (diff)
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: Colin Ian King <colin.king@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/wilc1000/coreconfigurator.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c
index 2c4ae1fc8435..4b51c0ac27ac 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -338,8 +338,10 @@ s32 wilc_parse_network_info(u8 *msg_buffer,
338 338
339 if (ies_len > 0) { 339 if (ies_len > 0) {
340 network_info->ies = kmemdup(ies, ies_len, GFP_KERNEL); 340 network_info->ies = kmemdup(ies, ies_len, GFP_KERNEL);
341 if (!network_info->ies) 341 if (!network_info->ies) {
342 kfree(network_info);
342 return -ENOMEM; 343 return -ENOMEM;
344 }
343 } 345 }
344 network_info->ies_len = ies_len; 346 network_info->ies_len = ies_len;
345 } 347 }
@@ -373,8 +375,10 @@ s32 wilc_parse_assoc_resp_info(u8 *buffer, u32 buffer_len,
373 AID_LEN); 375 AID_LEN);
374 376
375 connect_resp_info->ies = kmemdup(ies, ies_len, GFP_KERNEL); 377 connect_resp_info->ies = kmemdup(ies, ies_len, GFP_KERNEL);
376 if (!connect_resp_info->ies) 378 if (!connect_resp_info->ies) {
379 kfree(connect_resp_info);
377 return -ENOMEM; 380 return -ENOMEM;
381 }
378 382
379 connect_resp_info->ies_len = ies_len; 383 connect_resp_info->ies_len = ies_len;
380 } 384 }