Commit 0d9741ab authored by Dan Carpenter's avatar Dan Carpenter Committed by Rafael J. Wysocki

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: default avatarDan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 058f5e40
...@@ -928,8 +928,10 @@ static int acpi_thermal_add(struct acpi_device *device) ...@@ -928,8 +928,10 @@ static int acpi_thermal_add(struct acpi_device *device)
acpi_thermal_guess_offset(tz, crit_temp); acpi_thermal_guess_offset(tz, crit_temp);
trip = kcalloc(trip_count, sizeof(*trip), GFP_KERNEL); trip = kcalloc(trip_count, sizeof(*trip), GFP_KERNEL);
if (!trip) if (!trip) {
return -ENOMEM; result = -ENOMEM;
goto free_memory;
}
tz->trip_table = trip; tz->trip_table = trip;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment