Staging: dream: fix memory leak in camera error path
authorPavel Machek <pavel@ucw.cz>
Sat, 21 Nov 2009 08:16:47 +0000 (09:16 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 4 Mar 2010 00:42:26 +0000 (16:42 -0800)
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>
drivers/staging/dream/camera/msm_camera.c

index 7d938772eacc826077e221323f3c373eadc8959c..87e118d1882704c7b3e83a18239d5753acce8747 100644 (file)
@@ -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;