ACPI: power_meter: remove double kfree()
authorDarren Jenkins <darrenrjenkins@gmail.com>
Tue, 12 Jan 2010 12:37:07 +0000 (23:37 +1100)
committerLen Brown <len.brown@intel.com>
Wed, 20 Jan 2010 04:56:02 +0000 (23:56 -0500)
resource->domain_devices can be double kfree()'d in a couple of places.
Fix this by setting num_domain_devices = 0 after the kfree().

Coverity CID: 13356, 13355, 13354

Signed-off-by: Darren Jenkins <darrenrjenkins@gmail.com>
Acked-by: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/acpi/power_meter.c

index ca75c36f754cf5a73ff4e7c48b31f4bed6f696e7..dc4ffadf81220a2541f68f773514d430491b75b7 100644 (file)
@@ -534,6 +534,7 @@ static void remove_domain_devices(struct acpi_power_meter_resource *resource)
 
        kfree(resource->domain_devices);
        kobject_put(resource->holders_dir);
+       resource->num_domain_devices = 0;
 }
 
 static int read_domain_devices(struct acpi_power_meter_resource *resource)
@@ -740,7 +741,6 @@ skip_unsafe_cap:
 
        return res;
 error:
-       remove_domain_devices(resource);
        remove_attrs(resource);
        return res;
 }