diff options
author | Alexander Beregalov <a.beregalov@gmail.com> | 2010-01-09 13:51:14 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-02-26 15:10:35 -0300 |
commit | 8231152f74dd9bd6f76036cfd7fbbf94ad0073d8 (patch) | |
tree | 3338ec930be2c52d05c2824895bce6c431af000a | |
parent | 78b06e0201fb32716211959bce133740a13873c4 (diff) | |
download | lwn-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>
-rw-r--r-- | drivers/media/IR/ir-keytable.c | 4 |
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, |