diff mbox

ACPI processor: fix theoretical memleak

Message ID 4AB0A481.40306@tuffmail.co.uk (mailing list archive)
State RFC, archived
Headers show

Commit Message

Alan Jenkins Sept. 16, 2009, 8:40 a.m. UTC
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
---
 drivers/acpi/processor_core.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index 38ad5ef..0eb4a94 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -781,8 +781,8 @@  static int acpi_processor_add(struct acpi_device *device)
 		return -ENOMEM;
 
 	if (!zalloc_cpumask_var(&pr->throttling.shared_cpu_map, GFP_KERNEL)) {
-		kfree(pr);
-		return -ENOMEM;
+		result = -ENOMEM;
+		goto err_free_pr;
 	}
 
 	pr->handle = device->handle;
@@ -882,6 +882,8 @@  err_remove_fs:
 	acpi_processor_remove_fs(device);
 err_free_cpumask:
 	free_cpumask_var(pr->throttling.shared_cpu_map);
+err_free_pr:
+	kfree(pr);
 
 	return result;
 }