[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 <shailendra.v@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
Shailendra Verma 2016-11-25 02:52:04 -02:00 committed by Mauro Carvalho Chehab
parent 30f895a9e1
commit d39e74fdcd
1 changed files with 2 additions and 0 deletions

View File

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