linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] ACPI: free memory on an error path
@ 2012-09-25  7:01 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2012-09-25  7:01 UTC (permalink / raw)
  To: Len Brown, Lan Tianyu; +Cc: linux-acpi, kernel-janitors

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

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Only needed in linux-next.  Introduced in 1033f9041d5 "ACPI: Allow ACPI
binding with USB-3.0 hub".

diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index d1a2d74..cfeecac 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -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;

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-09-25  7:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-25  7:01 [patch] ACPI: free memory on an error path Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).