Skip to content

Commit 0d9741a

Browse files
Dan Carpenterrafaeljw
authored andcommitted
ACPI: thermal: Fix a small leak in acpi_thermal_add()
Free "tz" if the "trip" allocation fails. Fixes: 5fc2189 ("ACPI: thermal: Create and populate trip points table earlier") Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 058f5e4 commit 0d9741a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/acpi/thermal.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -928,8 +928,10 @@ static int acpi_thermal_add(struct acpi_device *device)
928928
acpi_thermal_guess_offset(tz, crit_temp);
929929

930930
trip = kcalloc(trip_count, sizeof(*trip), GFP_KERNEL);
931-
if (!trip)
932-
return -ENOMEM;
931+
if (!trip) {
932+
result = -ENOMEM;
933+
goto free_memory;
934+
}
933935

934936
tz->trip_table = trip;
935937

0 commit comments

Comments
 (0)