Skip to contentSkip to conversation

acpi thermal driver leaks in failure path

PATCH Dave Jones 1 participant 1 message Mar 9, 2006

Subsystems (2)
lore
Share & tools
lore

Dave Jones

author
#0 lore raw

Leaking memory in failure path.

Coverity: #601

drivers/acpi/thermal.c renamed from drivers/acpi/thermal.c~ +3 -1
@@ -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"));
Signature · 1 line
http://www.codemonkey.org.uk