]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
gpio: of: fix memory leak in of_gpiochip_init
authorAllen Yu <alleny@nvidia.com>
Mon, 26 May 2014 04:31:05 +0000 (12:31 +0800)
committerHarshada Kale <hkale@nvidia.com>
Tue, 27 May 2014 12:53:18 +0000 (05:53 -0700)
propname should be freed if fail to resolve the phandle property.

bug 200007297

Change-Id: I26bf03daaca976bea1450d3d4c40b358037d4339
Signed-off-by: Allen Yu <alleny@nvidia.com>
Reviewed-on: http://git-master/r/414812
GVS: Gerrit_Virtual_Submit
Reviewed-by: Thomas Cherry <tcherry@nvidia.com>
drivers/gpio/gpiolib-of.c

index 627b23cdabd8f674a3dd40b68f500326a8e0ce95..fc4fa8ad2b62bc1e1b3d1dba988c007216109122 100644 (file)
@@ -239,8 +239,10 @@ void of_gpiochip_init(struct gpio_chip *chip)
                /* Retrieve the gpio-init-* property */
                propname = kasprintf(GFP_KERNEL, "gpio-init-%d", state);
                np_config  = of_parse_phandle(np, propname, 0);
-               if (!np_config)
+               if (!np_config) {
+                       kfree(propname);
                        break;
+               }
 
                /* Determine whether gpio-init-names property names the state */
                of_property_read_string_index(np, "gpio-init-names",