Staging: dream: fix memory leak in camera error path
[pandora-kernel.git] / drivers / staging / dream / camera / msm_camera.c
index 7d93877..87e118d 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;