From: Santosh Kumar Singh Date: Mon, 19 Dec 2016 16:12:46 +0000 (-0200) Subject: [media] vim2m: Clean up file handle in open() error path X-Git-Tag: v4.11-rc1~132^2~150 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=7c13a4d6997ddb84b8c27bd90234c5ef1b020226;p=linux.git [media] vim2m: Clean up file handle in open() error path Fix to avoid possible memory leak and exit file handle in error paths. Signed-off-by: Santosh Kumar Singh Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/platform/vim2m.c b/drivers/media/platform/vim2m.c index a98f679bd88d..970b9b6dab25 100644 --- a/drivers/media/platform/vim2m.c +++ b/drivers/media/platform/vim2m.c @@ -907,6 +907,7 @@ static int vim2m_open(struct file *file) if (hdl->error) { rc = hdl->error; v4l2_ctrl_handler_free(hdl); + kfree(ctx); goto open_unlock; } ctx->fh.ctrl_handler = hdl; @@ -928,6 +929,7 @@ static int vim2m_open(struct file *file) rc = PTR_ERR(ctx->fh.m2m_ctx); v4l2_ctrl_handler_free(hdl); + v4l2_fh_exit(&ctx->fh); kfree(ctx); goto open_unlock; }