V4L/DVB: ir: fix memory leak
authorAlexander Beregalov <a.beregalov@gmail.com>
Sat, 9 Jan 2010 16:51:14 +0000 (13:51 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 26 Feb 2010 18:10:35 +0000 (15:10 -0300)
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>
drivers/media/IR/ir-keytable.c

index 161d70b57965d16680dee46b0823ddc6fed10264..0903f539bf685a89027f6fc309a3703f4687a688 100644 (file)
@@ -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,