From: Stefan Weil Date: Thu, 24 Feb 2011 21:11:48 +0000 (+0100) Subject: staging: brcm80211: Fix memory leak after kmalloc failure X-Git-Tag: firefly_0821_release~7613^2~2197^2~377 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2d586ea6de0ffe3e119ed0f1d4cb0adeb6874cbc;p=firefly-linux-kernel-4.4.55.git 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 Cc: Brett Rudley Cc: Henry Ptasinski Cc: linux-wireless@vger.kernel.org Cc: devel@driverdev.osuosl.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Stefan Weil Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_lcn.c b/drivers/staging/brcm80211/brcmsmac/phy/wlc_phy_lcn.c index 3fbbbb46a360..f027d5076c7d 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);