]> git.baikalelectronics.ru Git - kernel.git/commit
Staging, rtl8192e, softmac: remove redundant memset and fix mem leak
authorJesper Juhl <jj@chaosbits.net>
Sun, 12 Feb 2012 23:15:02 +0000 (00:15 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 Feb 2012 01:21:43 +0000 (17:21 -0800)
commita668a4d1139f08880a5e63ede4e0f9f9c3b72635
tree48ed8d762f5b9c19b92001b5e15761b72194299b
parentb60f86fbbb539c0649a66fa968aa35f9ed1d1154
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@chaosbits.net>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8192e/rtllib_softmac.c