From: Jesper Juhl Date: Wed, 11 Apr 2012 20:41:36 +0000 (+0200) Subject: ath6kl: fix memory leak in ath6kl_fwlog_block_read() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ae9a3405fd28ce05dc3d0b51d541fd5ec742b3b4;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git ath6kl: fix memory leak in ath6kl_fwlog_block_read() If, in drivers/net/wireless/ath/ath6kl/debug.c::ath6kl_fwlog_block_read(), the call to wait_for_completion_interruptible() returns -ERESTARTSYS then we'll return without freeing the (as yet unused) memory we allocated for 'buf' - thus leaking it. Signed-off-by: Jesper Juhl Signed-off-by: Kalle Valo --- diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c index 2bcd45095eb9..496382f472de 100644 --- a/drivers/net/wireless/ath/ath6kl/debug.c +++ b/drivers/net/wireless/ath/ath6kl/debug.c @@ -407,8 +407,10 @@ static ssize_t ath6kl_fwlog_block_read(struct file *file, ret = wait_for_completion_interruptible( &ar->debug.fwlog_completion); - if (ret == -ERESTARTSYS) + if (ret == -ERESTARTSYS) { + vfree(buf); return ret; + } spin_lock(&ar->debug.fwlog_queue.lock); }