]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
media: staging: media: davinci_vpfe: - Fix for memory leak if decoder initialization...
authorShailendra Verma <shailendra.v@samsung.com>
Fri, 25 Nov 2016 04:57:34 +0000 (23:57 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 31 Jul 2019 05:28:22 +0000 (07:28 +0200)
[ Upstream commit 6995a659101bd4effa41cebb067f9dc18d77520d ]

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+samsung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/staging/media/davinci_vpfe/vpfe_video.c

index 155e8c758e4b03a1abb4928268cc633e17c0841f..346e60d230f3d9a5e6f5015eb88368388b01895c 100644 (file)
@@ -422,6 +422,9 @@ static int vpfe_open(struct file *file)
        /* If decoder is not initialized. initialize it */
        if (!video->initialized && vpfe_update_pipe_state(video)) {
                mutex_unlock(&video->lock);
+               v4l2_fh_del(&handle->vfh);
+               v4l2_fh_exit(&handle->vfh);
+               kfree(handle);
                return -ENODEV;
        }
        /* Increment device users counter */