summaryrefslogtreecommitdiff
path: root/drivers/acpi/scan.c
diff options
context:
space:
mode:
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>2021-05-08 10:23:09 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2021-05-10 20:02:55 +0300
commit0c8bd174f0fc131bc9dfab35cd8784f59045da87 (patch)
tree52cc3d1b2944a2fd5d2f1b54f26c1a3710a18c15 /drivers/acpi/scan.c
parent6efb943b8616ec53a5e444193dccf1af9ad627b5 (diff)
downloadlinux-0c8bd174f0fc131bc9dfab35cd8784f59045da87.tar.xz
ACPI: scan: Fix a memory leak in an error handling path
If 'acpi_device_set_name()' fails, we must free 'acpi_device_bus_id->bus_id' or there is a (potential) memory leak. Fixes: eb50aaf960e3 ("ACPI: scan: Use unique number for instance_no") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/scan.c')
-rw-r--r--drivers/acpi/scan.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index a22778e880c2..651a431e2bbf 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -700,6 +700,7 @@ int acpi_device_add(struct acpi_device *device,
result = acpi_device_set_name(device, acpi_device_bus_id);
if (result) {
+ kfree_const(acpi_device_bus_id->bus_id);
kfree(acpi_device_bus_id);
goto err_unlock;
}