drivers/platform/x86: Fix memory leak
authorAndre Bartke <andre.bartke@googlemail.com>
Fri, 3 Jun 2011 18:55:43 +0000 (20:55 +0200)
committerMatthew Garrett <mjg@redhat.com>
Thu, 7 Jul 2011 14:39:03 +0000 (10:39 -0400)
data is not freed in the error case of
compal_probe().

Signed-off-by: Andre Bartke <andre.bartke@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
drivers/platform/x86/compal-laptop.c

index 3f204fd..8877b83 100644 (file)
@@ -1030,8 +1030,10 @@ static int __devinit compal_probe(struct platform_device *pdev)
        initialize_fan_control_data(data);
 
        err = sysfs_create_group(&pdev->dev.kobj, &compal_attribute_group);
-       if (err)
+       if (err) {
+               kfree(data);
                return err;
+       }
 
        data->hwmon_dev = hwmon_device_register(&pdev->dev);
        if (IS_ERR(data->hwmon_dev)) {