Skip to content

Commit

Permalink
Staging: dream: fix memory leak in camera error path
Browse files Browse the repository at this point in the history
cppcheck found that ctrl_pmsm is leaked if the open operation fails.

Signed-off-by: Eric Sesterhenn <eric.sesterhenn@lsexperts.de>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Pavel Machek authored and Greg Kroah-Hartman committed Mar 4, 2010
1 parent e79753e commit ccf972b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/staging/dream/camera/msm_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ccf972b

Please sign in to comment.