ACPI: scan: Fix a memory leak in an error handling path
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sat, 8 May 2021 07:23:09 +0000 (09:23 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 May 2021 08:13:13 +0000 (10:13 +0200)
commite2381174daeae0ca35eddffef02dcc8de8c1ef8a
tree57f441215be1aa3ade7cccfcd6b5db9c463c57be
parenta8dc16bbfe29c49987b77ed9240b1f54e5af539b
ACPI: scan: Fix a memory leak in an error handling path

[ Upstream commit 0c8bd174f0fc131bc9dfab35cd8784f59045da87 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/acpi/scan.c