[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1202130012140.13814@swampdragon.chaosbits.net>
Date: Mon, 13 Feb 2012 00:15:02 +0100 (CET)
From: Jesper Juhl <jj@...osbits.net>
To: devel@...verdev.osuosl.org
cc: linux-kernel@...r.kernel.org,
Andrea Merello <andreamrl@...cali.it>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Larry Finger <Larry.Finger@...inger.net>,
Sean MacLennan <seanm@...nm.ca>,
Mike McCormack <mikem@...g3k.org>
Subject: [PATCH] Staging, rtl8192e, softmac: remove redundant memset and fix
mem leak
In drivers/staging/rtl8192e/rtllib_softmac.c::rtllib_rx_assoc_resp()
we allocate memory for 'network' with kzalloc() and then proceed to
zero the already zeroed mem we got from kzalloc() with
memset(). That's redundant, so remove the memset()
We also fail to kfree() the memory we allocated for 'network' if we do not enter
if (ieee->current_network.qos_data.supported == 1) {
and the variable then goes out of scope.
To fix that I simply moved the kfree() that was inside that 'if'
statement to instead be just after it. It then covers both the case
where we take the branch and when we don't.
Signed-off-by: Jesper Juhl <jj@...osbits.net>
---
drivers/staging/rtl8192e/rtllib_softmac.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
Compile tested only.
diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c
index 1637f11..c5a15db 100644
--- a/drivers/staging/rtl8192e/rtllib_softmac.c
+++ b/drivers/staging/rtl8192e/rtllib_softmac.c
@@ -2234,7 +2234,6 @@ inline int rtllib_rx_assoc_resp(struct rtllib_device *ieee, struct sk_buff *skb,
if (!network)
return 1;
- memset(network, 0, sizeof(*network));
ieee->state = RTLLIB_LINKED;
ieee->assoc_id = aid;
ieee->softmac_stats.rx_ass_ok++;
@@ -2259,8 +2258,8 @@ inline int rtllib_rx_assoc_resp(struct rtllib_device *ieee, struct sk_buff *skb,
ieee->handle_assoc_response(ieee->dev,
(struct rtllib_assoc_response_frame *)header,
network);
- kfree(network);
}
+ kfree(network);
kfree(ieee->assocresp_ies);
ieee->assocresp_ies = NULL;
--
1.7.9
--
Jesper Juhl <jj@...osbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.
--
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