mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-05 11:01:06 -04:00
ACPI: thermal: Fix a small leak in acpi_thermal_add()
Free "tz" if the "trip" allocation fails.
Fixes: 5fc2189f9335 ("ACPI: thermal: Create and populate trip points table earlier")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
committed by
Rafael J. Wysocki
parent
058f5e407d
commit
0d9741abd1
@@ -928,8 +928,10 @@ static int acpi_thermal_add(struct acpi_device *device)
|
||||
acpi_thermal_guess_offset(tz, crit_temp);
|
||||
|
||||
trip = kcalloc(trip_count, sizeof(*trip), GFP_KERNEL);
|
||||
if (!trip)
|
||||
return -ENOMEM;
|
||||
if (!trip) {
|
||||
result = -ENOMEM;
|
||||
goto free_memory;
|
||||
}
|
||||
|
||||
tz->trip_table = trip;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user