summaryrefslogtreecommitdiff
path: root/drivers/media/IR/ir-keytable.c
diff options
context:
space:
mode:
authorAlexander Beregalov <a.beregalov@gmail.com>2010-01-09 13:51:14 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-02-26 15:10:35 -0300
commit8231152f74dd9bd6f76036cfd7fbbf94ad0073d8 (patch)
tree3338ec930be2c52d05c2824895bce6c431af000a /drivers/media/IR/ir-keytable.c
parent78b06e0201fb32716211959bce133740a13873c4 (diff)
downloadlwn-8231152f74dd9bd6f76036cfd7fbbf94ad0073d8.tar.gz
lwn-8231152f74dd9bd6f76036cfd7fbbf94ad0073d8.zip
V4L/DVB: ir: fix memory leak
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>
Diffstat (limited to 'drivers/media/IR/ir-keytable.c')
-rw-r--r--drivers/media/IR/ir-keytable.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c
index 161d70b57965..0903f539bf68 100644
--- a/drivers/media/IR/ir-keytable.c
+++ b/drivers/media/IR/ir-keytable.c
@@ -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,