driver core: location: Free struct acpi_pld_info *pld before return false
authorHanjun Guo <guohanjun@huawei.com>
Tue, 22 Nov 2022 07:37:28 +0000 (15:37 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:33:33 +0000 (09:33 +0100)
commit8fe72b8f59f63ca776bb8a4fcd2f406057a9fc90
tree63fa94f28e2431563e37de739f9eb2ac2548d719
parentd1dbff10c6cd3b43457f3efd3c9c4950009635bf
driver core: location: Free struct acpi_pld_info *pld before return false

[ Upstream commit 0d150f967e8410e1e6712484543eec709356a65d ]

struct acpi_pld_info *pld should be freed before the return of allocation
failure, to prevent memory leak, add the ACPI_FREE() to fix it.

Fixes: bc443c31def5 ("driver core: location: Check for allocations failure")
Signed-off-by: Hanjun Guo <guohanjun@huawei.com>
Link: https://lore.kernel.org/r/1669102648-11517-1-git-send-email-guohanjun@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/base/physical_location.c