lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1444389093-10309-1-git-send-email-colin.king@canonical.com>
Date:	Fri,  9 Oct 2015 12:11:33 +0100
From:	Colin King <colin.king@...onical.com>
To:	Johnny Kim <johnny.kim@...el.com>,
	Rachel Kim <rachel.kim@...el.com>,
	Dean Lee <dean.lee@...el.com>,
	Chris Park <chris.park@...el.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	linux-wireless@...r.kernel.org, devel@...verdev.osuosl.org
Cc:	linux-kernel@...r.kernel.org
Subject: [PATCH] staging: wilc1000: fix memory leak on mgmt_tx on error return path

From: Colin Ian King <colin.king@...onical.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@...onical.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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ