public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH ACPI] memory leakages in drivers/acpi/thermal.c
@ 2006-04-09 15:08 Vasily Averin
  0 siblings, 0 replies; only message in thread
From: Vasily Averin @ 2006-04-09 15:08 UTC (permalink / raw)
  To: Len Brown, linux-acpi, Linux Kernel Mailing List, Andrew Morton,
	Kirill Korotaev, devel

[-- Attachment #1: Type: text/plain, Size: 228 bytes --]

acpi_thermal_write_trip_points() and acpi_thermal_add() do not call kfree() for
allocated memory on the error path.

Signed-off-by: Vasily Averin <vvs@sw.ru>

Thank you,
	Vasily Averin

SWsoft Virtuozzo/OpenVZ Linux kernel team

[-- Attachment #2: diff-ms-acpi-thermal-20060409 --]
[-- Type: text/plain, Size: 720 bytes --]

--- a/drivers/acpi/thermal.c	2006-04-09 17:03:50.000000000 +0400
+++ b/drivers/acpi/thermal.c	2006-04-09 17:46:41.000000000 +0400
@@ -942,8 +942,10 @@ acpi_thermal_write_trip_points(struct fi
 	memset(limit_string, 0, ACPI_THERMAL_MAX_LIMIT_STR_LEN);
 
 	active = kmalloc(ACPI_THERMAL_MAX_ACTIVE * sizeof(int), GFP_KERNEL);
-	if (!active)
+	if (!active) {
+		kfree(limit_string);
 		return_VALUE(-ENOMEM);
+	}
 
 	if (!tz || (count > ACPI_THERMAL_MAX_LIMIT_STR_LEN - 1)) {
 		ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument\n"));
@@ -1342,7 +1344,7 @@ static int acpi_thermal_add(struct acpi_
 
 	result = acpi_thermal_add_fs(device);
 	if (result)
-		return_VALUE(result);
+		goto end;
 
 	init_timer(&tz->timer);
 

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

only message in thread, other threads:[~2006-04-09 15:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-09 15:08 [PATCH ACPI] memory leakages in drivers/acpi/thermal.c Vasily Averin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox