staging: vt6656: Don't leak memory in drivers/staging/vt6656/ioctl.c::private_ioctl()
authorJesper Juhl <jj@chaosbits.net>
Wed, 11 Apr 2012 22:35:46 +0000 (00:35 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Apr 2012 21:34:31 +0000 (14:34 -0700)
commit17b7e1ba1e2ecc9a09f5e154e555accd2a2eaedf
tree7ecf4e5154c5f52d08f692b66c81c0d631e56990
parent62d2feb9803f18c4e3c8a1a2c7e30a54df8a1d72
staging: vt6656: Don't leak memory in drivers/staging/vt6656/ioctl.c::private_ioctl()

If copy_to_user() fails in the WLAN_CMD_GET_NODE_LIST case of the
switch in drivers/staging/vt6656/ioctl.c::private_ioctl() we'll leak
the memory allocated to 'pNodeList'. Fix that by kfree'ing the memory
in the failure case.
Also remove a pointless cast (to type 'PSNodeList') of a kmalloc()
return value - kmalloc() returns a void pointer that is implicitly
converted, so there is no need for an explicit cast.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vt6656/ioctl.c