diff options
author | Dan Carpenter <dan.carpenter@linaro.org> | 2023-09-27 14:37:26 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2023-09-27 14:58:14 +0200 |
commit | 0d9741abd1c583e7bedb178358a9abd0981f49ba (patch) | |
tree | 3ee8c1902e911be7f94eb610feb8bf370b582aad /drivers/acpi/thermal.c | |
parent | ACPI: thermal: Drop valid flag from struct acpi_thermal_trip (diff) | |
download | linux-0d9741abd1c583e7bedb178358a9abd0981f49ba.tar.xz linux-0d9741abd1c583e7bedb178358a9abd0981f49ba.zip |
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>
Diffstat (limited to 'drivers/acpi/thermal.c')
-rw-r--r-- | drivers/acpi/thermal.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 10720a038846..f8a95939c88d 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -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; |