Skip to contentSkip to conversation

ACPI: free memory on an error path

PATCH New Dan Carpenter 1 participant 1 message Sep 25, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI: free memory on an error path

We should free "physical_node" if before returning the error code.

---
Only needed in linux-next. Introduced in 1033f9041d5 "ACPI: Allow ACPI binding with USB-3.0 hub".

drivers/acpi/glue.c +3 -1
index d1a2d74..cfeecac 100644
@@ -159,7 +159,7 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle)
 	if (physical_node->node_id >= ACPI_MAX_PHYSICAL_NODE) {
 		retval = -ENOSPC;
 		mutex_unlock(&acpi_dev->physical_node_lock);
-		goto err;
+		goto free_node;
 	}
 
 	set_bit(physical_node->node_id, acpi_dev->physical_node_id_bitmap);
@@ -185,6 +185,8 @@ static int acpi_bind_one(struct device *dev, acpi_handle handle)
 
 	return 0;
 
+free_node:
+	kfree(physical_node);
  err:
 	put_device(dev);
 	return retval;