* [PATCH] staging: wilc1000: fix memory leak on mgmt_tx on error return path
@ 2015-10-09 11:11 Colin King
2015-10-10 8:55 ` Sudip Mukherjee
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2015-10-09 11:11 UTC (permalink / raw)
To: Johnny Kim, Rachel Kim, Dean Lee, Chris Park, Greg Kroah-Hartman,
linux-wireless, devel
Cc: linux-kernel
From: Colin Ian King <colin.king@canonical.com>
Static analysis with cppcheck found the following memory leak:
[drivers/staging/wilc1000/linux_mon.c:255]: (error) Memory leak: mgmt_tx
Free mgmt_tx on the error return path when mgmt_tx->buff fails to be
allocated.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/staging/wilc1000/linux_mon.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c
index b8d7d04..f35d6ba 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -252,6 +252,7 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len)
mgmt_tx->buff = kmalloc(len, GFP_ATOMIC);
if (mgmt_tx->buff == NULL) {
PRINT_ER("Failed to allocate memory for mgmt_tx buff\n");
+ kfree(mgmt_tx);
return WILC_FAIL;
}
--
2.5.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] staging: wilc1000: fix memory leak on mgmt_tx on error return path
2015-10-09 11:11 [PATCH] staging: wilc1000: fix memory leak on mgmt_tx on error return path Colin King
@ 2015-10-10 8:55 ` Sudip Mukherjee
0 siblings, 0 replies; 2+ messages in thread
From: Sudip Mukherjee @ 2015-10-10 8:55 UTC (permalink / raw)
To: Colin King
Cc: Johnny Kim, Rachel Kim, Dean Lee, Chris Park, Greg Kroah-Hartman,
linux-wireless, devel, linux-kernel
On Fri, Oct 09, 2015 at 12:11:33PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Static analysis with cppcheck found the following memory leak:
>
> [drivers/staging/wilc1000/linux_mon.c:255]: (error) Memory leak: mgmt_tx
>
> Free mgmt_tx on the error return path when mgmt_tx->buff fails to be
> allocated.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
This has already been done by:
f638dd3918a4 ("staging: wilc1000: fix potential memory leak")
regards
sudip
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-10-10 8:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-09 11:11 [PATCH] staging: wilc1000: fix memory leak on mgmt_tx on error return path Colin King
2015-10-10 8:55 ` Sudip Mukherjee
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.