]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
[media] vim2m: Clean up file handle in open() error path
authorSantosh Kumar Singh <kumar.san1093@gmail.com>
Mon, 19 Dec 2016 16:12:46 +0000 (14:12 -0200)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Tue, 31 Jan 2017 09:44:26 +0000 (07:44 -0200)
Fix to avoid possible memory leak and exit file handle
in error paths.

Signed-off-by: Santosh Kumar Singh <kumar.san1093@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/platform/vim2m.c

index a98f679bd88d0ba57ec1c8b99afc4174c6e1d88d..970b9b6dab25562200e6a0243b1d50218aafab45 100644 (file)
@@ -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;
        }