ACPI: free memory on an error path
Subsystems (2)
PATCH 1/1 ACPI: free memory on an error path
We should free "physical_node" if before returning the error code.
Signed-off-by Dan Carpenter <[email protected]>
---
Only needed in linux-next. Introduced in 1033f9041d5 "ACPI: Allow ACPI binding with USB-3.0 hub".
drivers/acpi/glue.c +3 -1
@@ -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;