From: Dan Carpenter Date: Wed, 5 May 2010 05:58:57 +0000 (-0300) Subject: V4L/DVB: media/mem2mem: dereferencing free memory X-Git-Tag: MMI-PSA29.97-13-9~23880^2~10 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=16ee9bb100340f9f775ab334acb645f54642f312;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git V4L/DVB: media/mem2mem: dereferencing free memory We dereferenced "ctx" on the error path. Signed-off-by: Dan Carpenter Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/video/mem2mem_testdev.c b/drivers/media/video/mem2mem_testdev.c index baf211b9f6ce..b161d26b0ddf 100644 --- a/drivers/media/video/mem2mem_testdev.c +++ b/drivers/media/video/mem2mem_testdev.c @@ -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);