summaryrefslogtreecommitdiff
path: root/drivers/staging/bcm
diff options
context:
space:
mode:
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>2012-09-03 10:02:23 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-09-04 21:14:08 (GMT)
commitdce15efebe76088dc381ab91156842ebf7c79aca (patch)
tree51904296c1d057aac564e3b1e21ad0d37537a11c /drivers/staging/bcm
parentc14d01b8a159b9b6a337ccd91de2b89c8f37b3a4 (diff)
downloadlinux-fsl-qoriq-dce15efebe76088dc381ab91156842ebf7c79aca.tar.xz
staging: bcm: fix possible memory leak in bcm_char_ioctl()
psFwInfo has been allocated in this function and should be freed before leaving from the error handling cases. spatch with a semantic match is used to found this problem. (http://coccinelle.lip6.fr/) Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/bcm')
-rw-r--r--drivers/staging/bcm/Bcmchar.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c
index cf411d1..3d02c2e 100644
--- a/drivers/staging/bcm/Bcmchar.c
+++ b/drivers/staging/bcm/Bcmchar.c
@@ -820,6 +820,7 @@ cntrlEnd:
if (copy_from_user(psFwInfo, IoBuffer.InputBuffer, IoBuffer.InputLength)) {
up(&Adapter->fw_download_sema);
+ kfree(psFwInfo);
return -EFAULT;
}
@@ -829,6 +830,7 @@ cntrlEnd:
BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Something else is wrong %lu\n",
psFwInfo->u32FirmwareLength);
up(&Adapter->fw_download_sema);
+ kfree(psFwInfo);
Status = -EINVAL;
return Status;
}