drivers: mcb: fix memory leak in chameleon_parse_cells() error path
authorChristoph Jaeger <christophjaeger@linux.com>
Fri, 11 Apr 2014 16:40:05 +0000 (18:40 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Apr 2014 19:28:47 +0000 (12:28 -0700)
chameleon_parse_cells() bails out if chameleon descriptor type is
invalid but does not free the storage 'header' points to.

Signed-off-by: Christoph Jaeger <christophjaeger@linux.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@men.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mcb/mcb-parse.c

index d1278b5f3028dbc765f0da3fef90f0e99894170c..00492695526354f104b115c61546142d77d47c46 100644 (file)
@@ -141,6 +141,7 @@ int chameleon_parse_cells(struct mcb_bus *bus, phys_addr_t mapbase,
                default:
                        pr_err("Invalid chameleon descriptor type 0x%x\n",
                                dtype);
+                       kfree(header);
                        return -EINVAL;
                }
                num_cells++;