From: Pavel Machek Date: Sat, 21 Nov 2009 08:16:47 +0000 (+0100) Subject: Staging: dream: fix memory leak in camera error path X-Git-Tag: MMI-PSA29.97-13-9~24618^2~1^2~346 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ccf972bd6bcb35ebd38e0a530c86088e45102aa4;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git Staging: dream: fix memory leak in camera error path cppcheck found that ctrl_pmsm is leaked if the open operation fails. Signed-off-by: Eric Sesterhenn Signed-off-by: Pavel Machek Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/dream/camera/msm_camera.c b/drivers/staging/dream/camera/msm_camera.c index 7d938772eacc..87e118d18827 100644 --- a/drivers/staging/dream/camera/msm_camera.c +++ b/drivers/staging/dream/camera/msm_camera.c @@ -1885,8 +1885,10 @@ static int msm_open_control(struct inode *inode, struct file *filep) return -ENOMEM; rc = msm_open_common(inode, filep, 0); - if (rc < 0) + if (rc < 0) { + kfree(ctrl_pmsm); return rc; + } ctrl_pmsm->pmsm = filep->private_data; filep->private_data = ctrl_pmsm;