V4L/DVB: media/mem2mem: dereferencing free memory
authorDan Carpenter <error27@gmail.com>
Wed, 5 May 2010 05:58:57 +0000 (02:58 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 19 May 2010 15:59:13 +0000 (12:59 -0300)
We dereferenced "ctx" on the error path.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/mem2mem_testdev.c

index baf211b9f6ce7a99249d50f3040a0272310e8ed0..b161d26b0ddff539396ecb69961a48c15f87ad5c 100644 (file)
@@ -871,8 +871,10 @@ static int m2mtest_open(struct file *file)
 
        ctx->m2m_ctx = v4l2_m2m_ctx_init(ctx, dev->m2m_dev, queue_init);
        if (IS_ERR(ctx->m2m_ctx)) {
+               int ret = PTR_ERR(ctx->m2m_ctx);
+
                kfree(ctx);
-               return PTR_ERR(ctx->m2m_ctx);
+               return ret;
        }
 
        atomic_inc(&dev->num_inst);