Skip to content

Commit a7b2df7

Browse files
Navidemmchehab
authored andcommitted
media: rc: prevent memory leak in cx23888_ir_probe
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>
1 parent 3eab054 commit a7b2df7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: drivers/media/pci/cx23885/cx23888-ir.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -1167,8 +1167,11 @@ int cx23888_ir_probe(struct cx23885_dev *dev)
11671167
return -ENOMEM;
11681168

11691169
spin_lock_init(&state->rx_kfifo_lock);
1170-
if (kfifo_alloc(&state->rx_kfifo, CX23888_IR_RX_KFIFO_SIZE, GFP_KERNEL))
1170+
if (kfifo_alloc(&state->rx_kfifo, CX23888_IR_RX_KFIFO_SIZE,
1171+
GFP_KERNEL)) {
1172+
kfree(state);
11711173
return -ENOMEM;
1174+
}
11721175

11731176
state->dev = dev;
11741177
sd = &state->sd;

0 commit comments

Comments
 (0)