Skip to content

Commit

Permalink
V4L/DVB: ir: fix memory leak
Browse files Browse the repository at this point in the history
Free ir_dev before exit.
Found by cppcheck.

Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Alexander Beregalov authored and Mauro Carvalho Chehab committed Feb 26, 2010
1 parent 78b06e0 commit 8231152
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/media/IR/ir-keytable.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,10 @@ int ir_input_register(struct input_dev *input_dev,
ir_dev->rc_tab.size = ir_roundup_tablesize(rc_tab->size);
ir_dev->rc_tab.scan = kzalloc(ir_dev->rc_tab.size *
sizeof(struct ir_scancode), GFP_KERNEL);
if (!ir_dev->rc_tab.scan)
if (!ir_dev->rc_tab.scan) {
kfree(ir_dev);
return -ENOMEM;
}

IR_dprintk(1, "Allocated space for %d keycode entries (%zd bytes)\n",
ir_dev->rc_tab.size,
Expand Down

0 comments on commit 8231152

Please sign in to comment.