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-prev] [day] [month] [year] [list]
Date:	Thu, 24 Feb 2011 22:11:48 +0100
From:	Stefan Weil <weil@...l.berlios.de>
To:	greg@...ah.com
Cc:	Stefan Weil <weil@...l.berlios.de>,
	Brett Rudley <brudley@...adcom.com>,
	Henry Ptasinski <henryp@...adcom.com>,
	Greg Kroah-Hartman <gregkh@...e.de>,
	linux-wireless@...r.kernel.org, devel@...verdev.osuosl.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH v2] staging: brcm80211: Fix memory leak after kmalloc failure

This error was spotted by cppcheck:

drivers/staging/brcm80211/phy/wlc_phy_lcn.c:4053: error: Memory leak: ptr

v2:
Rebased patch on linux-next (file was moved to a new directory).

Cc: Brett Rudley <brudley@...adcom.com>
Cc: Henry Ptasinski <henryp@...adcom.com>
Cc: Greg Kroah-Hartman <gregkh@...e.de>
Cc: linux-wireless@...r.kernel.org
Cc: devel@...verdev.osuosl.org
Cc: linux-kernel@...r.kernel.org
Signed-off-by: Stefan Weil <weil@...l.berlios.de>
---
 .../staging/brcm80211/brcmsmac/phy/wlc_phy_lcn.c   |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_lcn.c b/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_lcn.c
index 3fbbbb4..f027d50 100644
--- a/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_lcn.c
+++ b/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_lcn.c
@@ -4051,6 +4051,7 @@ wlc_lcnphy_a1(phy_info_t *pi, int cal_type, int num_levels, int step_size_lg2)
 
 	phy_c32 = kmalloc(sizeof(u16) * 20, GFP_ATOMIC);
 	if (NULL == phy_c32) {
+		kfree(ptr);
 		return;
 	}
 	phy_c26 = read_phy_reg(pi, 0x6da);
-- 
1.7.2.3

--
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