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)
committerVarun Wadekar <vwadekar@nvidia.com>
Wed, 18 Apr 2012 14:47:48 +0000 (19:47 +0530)
commitd308e8433b22cfa5d1c417eb50ad4d88157fc38f
tree3a4c76ecdec2ae118efeaa642fccde6f6d53b3e8
parent56a2568395b5d50dfe0c39e7c6d7915d34a733d7
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