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 <shailendr...@samsung.com>
---
 drivers/media/platform/davinci/vpfe_capture.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/platform/davinci/vpfe_capture.c 
b/drivers/media/platform/davinci/vpfe_capture.c
index 6efb2f1..188b333 100644
--- a/drivers/media/platform/davinci/vpfe_capture.c
+++ b/drivers/media/platform/davinci/vpfe_capture.c
@@ -526,6 +526,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;
                }
        }
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to