From 685f15e253a236d70840d1f5cfa8985206d006fc Mon Sep 17 00:00:00 2001 From: Serge Gautherie <32623169+SergeGautherie@users.noreply.github.com> Date: Thu, 31 Dec 2020 15:42:42 +0100 Subject: [PATCH] [ACPI] acpi_create_registry_table(): Close the key handle, on errors (#3372) Addendum to 44f1cf1 (r74559). CORE-12942 --- drivers/bus/acpi/busmgr/utils.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/bus/acpi/busmgr/utils.c b/drivers/bus/acpi/busmgr/utils.c index dfe216461ab..fc41f34fdb5 100644 --- a/drivers/bus/acpi/busmgr/utils.c +++ b/drivers/bus/acpi/busmgr/utils.c @@ -415,6 +415,7 @@ acpi_create_registry_table(HANDLE ParentKeyHandle, ACPI_TABLE_HEADER *OutTable, if (!NT_SUCCESS(Status)) { DPRINT1("RtlAnsiStringToUnicodeString() for %s failed (Status 0x%08lx)\n", HardwareKeyNameA, Status); + ZwClose(KeyHandle); return Status; } @@ -444,6 +445,7 @@ acpi_create_registry_table(HANDLE ParentKeyHandle, ACPI_TABLE_HEADER *OutTable, if (!NT_SUCCESS(Status)) { DPRINT1("RtlAnsiStringToUnicodeString() for %s failed (Status 0x%08lx)\n", HardwareKeyNameA, Status); + ZwClose(KeyHandle); return Status; } @@ -475,6 +477,7 @@ acpi_create_registry_table(HANDLE ParentKeyHandle, ACPI_TABLE_HEADER *OutTable, if (!NT_SUCCESS(Status)) { DPRINT1("RtlStringCbPrintfW() for 0x%08lx failed (Status 0x%08lx)\n", OutTable->OemRevision, Status); + ZwClose(KeyHandle); return Status; } RtlInitUnicodeString(&HardwareKeyName, OemRevision);