git: 3ff497061b33 - main - Fix Coverity issue in the NVDIMM driver
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 23 Feb 2023 02:42:38 UTC
The branch main has been updated by dab: URL: https://cgit.FreeBSD.org/src/commit/?id=3ff497061b3323021ae5f8cceed075fc2bc25e40 commit 3ff497061b3323021ae5f8cceed075fc2bc25e40 Author: Robert Herndon <Robert.Herndon@Dell.com> AuthorDate: 2022-10-13 17:02:28 +0000 Commit: David Bright <dab@FreeBSD.org> CommitDate: 2023-02-23 02:42:12 +0000 Fix Coverity issue in the NVDIMM driver Summary: Coverity reports a potential memory leak in the nvdimm driver. Examination shows it's real; fix it. Sponsored by: Dell Technologies MFC after: 1w Test Plan: Changes in use at $WORK Reviewers: robert.herndon_dell.com, vangyzen, bret_ketchum_dell.com Subscribers: imp, badger Differential Revision: https://reviews.freebsd.org/D38676 --- sys/dev/nvdimm/nvdimm_acpi.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/dev/nvdimm/nvdimm_acpi.c b/sys/dev/nvdimm/nvdimm_acpi.c index 7e41b04fd60f..11afe44f9477 100644 --- a/sys/dev/nvdimm/nvdimm_acpi.c +++ b/sys/dev/nvdimm/nvdimm_acpi.c @@ -67,14 +67,18 @@ find_dimm(ACPI_HANDLE handle, UINT32 nesting_level, void *context, ACPI_DEVICE_INFO *device_info; ACPI_STATUS status; + device_info = NULL; status = AcpiGetObjectInfo(handle, &device_info); if (ACPI_FAILURE(status)) return_ACPI_STATUS(AE_ERROR); if (device_info->Address == (uintptr_t)context) { *(ACPI_HANDLE *)return_value = handle; - return_ACPI_STATUS(AE_CTRL_TERMINATE); - } - return_ACPI_STATUS(AE_OK); + status = AE_CTRL_TERMINATE; + } else + status = AE_OK; + + AcpiOsFree(device_info); + return_ACPI_STATUS(status); } static ACPI_HANDLE