[media] Staging: media: platform: davinci: - Fix for memory leak
authorShailendra Verma <shailendra.v@samsung.com>
Fri, 25 Nov 2016 04:52:04 +0000 (02:52 -0200)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Fri, 3 Feb 2017 09:14:28 +0000 (07:14 -0200)
Fix to avoid possible memory leak if the decoder initialization got failed.
Free the allocated memory for file handle object before return in case
decoder initialization fails.

Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/platform/davinci/vpfe_capture.c

index e3a2b2e..e3fe3e0 100644 (file)
@@ -519,6 +519,8 @@ static int vpfe_open(struct file *file)
        if (!vpfe_dev->initialized) {
                if (vpfe_initialize_device(vpfe_dev)) {
                        mutex_unlock(&vpfe_dev->lock);
+                       v4l2_fh_exit(&fh->fh);
+                       kfree(fh);
                        return -ENODEV;
                }
        }