From: Alexander Beregalov Date: Sat, 9 Jan 2010 16:51:14 +0000 (-0300) Subject: V4L/DVB: ir: fix memory leak X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=8231152f74dd9bd6f76036cfd7fbbf94ad0073d8;p=openwrt%2Fstaging%2Fblogic.git V4L/DVB: ir: fix memory leak Free ir_dev before exit. Found by cppcheck. Signed-off-by: Alexander Beregalov Signed-off-by: Mauro Carvalho Chehab --- 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,