Skip to content

Commit

Permalink
[media] em28xx-input: NULL dereference on error
Browse files Browse the repository at this point in the history
We call "kfree(ir->i2c_client);" in the error handling and that doesn't
work if "ir" is NULL.

Fixes: 78e719a ('[media] em28xx-input: i2c IR decoders: improve i2c_client handling')

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
  • Loading branch information
Dan Carpenter authored and Mauro Carvalho Chehab committed Oct 24, 2014
1 parent 1a5cfd0 commit 34d7c24
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/media/usb/em28xx/em28xx-input.c
Original file line number Diff line number Diff line change
Expand Up @@ -712,8 +712,10 @@ static int em28xx_ir_init(struct em28xx *dev)
em28xx_info("Registering input extension\n");

ir = kzalloc(sizeof(*ir), GFP_KERNEL);
if (!ir)
return -ENOMEM;
rc = rc_allocate_device();
if (!ir || !rc)
if (!rc)
goto error;

/* record handles to ourself */
Expand Down

0 comments on commit 34d7c24

Please sign in to comment.