]> Git Repo - linux.git/commitdiff
ACPI: scan: Fix a memory leak in an error handling path
authorChristophe JAILLET <[email protected]>
Sat, 8 May 2021 07:23:09 +0000 (09:23 +0200)
committerRafael J. Wysocki <[email protected]>
Mon, 10 May 2021 17:02:55 +0000 (19:02 +0200)
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 <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
drivers/acpi/scan.c

index a22778e880c22e58c5f5e74629666c5a033e9482..651a431e2bbf15aa79b824be1c67cc60d8c0b50e 100644 (file)
@@ -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;
                }
This page took 0.06185 seconds and 4 git commands to generate.