Skip to content

Commit

Permalink
media: rc: prevent memory leak in cx23888_ir_probe
Browse files Browse the repository at this point in the history
In cx23888_ir_probe if kfifo_alloc fails the allocated memory for state
should be released.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
  • Loading branch information
Navidem authored and mchehab committed Oct 7, 2019
1 parent 3eab054 commit a7b2df7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/media/pci/cx23885/cx23888-ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1167,8 +1167,11 @@ int cx23888_ir_probe(struct cx23885_dev *dev)
return -ENOMEM;

spin_lock_init(&state->rx_kfifo_lock);
if (kfifo_alloc(&state->rx_kfifo, CX23888_IR_RX_KFIFO_SIZE, GFP_KERNEL))
if (kfifo_alloc(&state->rx_kfifo, CX23888_IR_RX_KFIFO_SIZE,
GFP_KERNEL)) {
kfree(state);
return -ENOMEM;
}

state->dev = dev;
sd = &state->sd;
Expand Down

0 comments on commit a7b2df7

Please sign in to comment.