From d39e74fdcdcca2e40f5397c3436bc9b8106a66a0 Mon Sep 17 00:00:00 2001 From: Shailendra Verma Date: Fri, 25 Nov 2016 02:52:04 -0200 Subject: [PATCH] [media] Staging: media: platform: davinci: - Fix for memory leak 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 Signed-off-by: Mauro Carvalho Chehab --- 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 e3a2b2e42128..e3fe3e0635aa 100644 --- a/drivers/media/platform/davinci/vpfe_capture.c +++ b/drivers/media/platform/davinci/vpfe_capture.c @@ -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; } } -- 2.20.1