]> www.infradead.org Git - users/jedix/linux-maple.git/commit
thermal: core: Fix memory leak in the error path
authorDaniel Lezcano <daniel.lezcano@linaro.org>
Fri, 19 Mar 2021 19:36:18 +0000 (20:36 +0100)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Fri, 19 Mar 2021 20:19:08 +0000 (21:19 +0100)
commit35b649a3cc1c45f9459ae6ee8e669c694dc62e0e
treeeafa525c18cf902c9cbb38705cccf1b5484e1ef9
parentef6e01af398acff63eb33c58e72839e50a3e1c4b
thermal: core: Fix memory leak in the error path

Fix the following error:

 smatch warnings:
 drivers/thermal/thermal_core.c:1020 __thermal_cooling_device_register() warn: possible memory leak of 'cdev'

by freeing the cdev when exiting the function in the error path.

Fixes: 584837618100 ("thermal/drivers/core: Use a char pointer for the cooling device name")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
drivers/thermal/thermal_core.c