Thread (4 messages) flat view 4 messages, 2 authors, 2011-02-24
STALE5691d

[PATCH] staging: brcm80211: Fix memory leak after kmalloc failure

From: Stefan Weil <hidden>
Date: 2011-02-19 23:29:24
Also in: lkml
Subsystem: staging subsystem, the rest · Maintainers: Greg Kroah-Hartman, Linus Torvalds

This error was spotted by cppcheck:

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

Cc: Brett Rudley <redacted>
Cc: Henry Ptasinski <redacted>
Cc: linux-wireless@vger.kernel.org
Cc: devel@driverdev.osuosl.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Stefan Weil <redacted>
---
 drivers/staging/brcm80211/phy/wlc_phy_lcn.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/staging/brcm80211/phy/wlc_phy_lcn.c b/drivers/staging/brcm80211/phy/wlc_phy_lcn.c
index 3ac2b49..9e2cb60 100644
--- a/drivers/staging/brcm80211/phy/wlc_phy_lcn.c
+++ b/drivers/staging/brcm80211/phy/wlc_phy_lcn.c
@@ -4050,6 +4050,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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help