hwmon: (acpi_power_meter) Fix potential memory leak in acpi_power_meter_add()
authorMisono Tomohiro <misono.tomohiro@jp.fujitsu.com>
Thu, 25 Jun 2020 04:32:42 +0000 (13:32 +0900)
committerGuenter Roeck <linux@roeck-us.net>
Thu, 25 Jun 2020 23:06:06 +0000 (16:06 -0700)
commit8b97f9922211c44a739c5cbd9502ecbb9f17f6d1
tree2904c7078b62cf6ab185cbb9331f4388ff860817
parent016983d138cbe99a5c0aaae0103ee88f5300beb3
hwmon: (acpi_power_meter) Fix potential memory leak in acpi_power_meter_add()

Although it rarely happens, we should call free_capabilities()
if error happens after read_capabilities() to free allocated strings.

Fixes: de584afa5e188 ("hwmon driver for ACPI 4.0 power meters")
Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
Link: https://lore.kernel.org/r/20200625043242.31175-1-misono.tomohiro@jp.fujitsu.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/acpi_power_meter.c