diff --git a/ntoskrnl/config/cmsysini.c b/ntoskrnl/config/cmsysini.c index d401c726e1b..a8ddc104073 100644 --- a/ntoskrnl/config/cmsysini.c +++ b/ntoskrnl/config/cmsysini.c @@ -1109,7 +1109,11 @@ CmpCreateRegistryRoot(VOID) /* Sanity check, and get the key cell */ ASSERT((&CmiVolatileHive->Hive)->ReleaseCellRoutine == NULL); KeyCell = (PCM_KEY_NODE)HvGetCell(&CmiVolatileHive->Hive, RootIndex); - if (!KeyCell) return FALSE; + if (!KeyCell) + { + ObDereferenceObject(RootKey); + return FALSE; + } /* Create the KCB */ RtlInitUnicodeString(&KeyName, L"\\REGISTRY"); @@ -1144,7 +1148,6 @@ CmpCreateRegistryRoot(VOID) &CmpRegistryRootHandle); if (!NT_SUCCESS(Status)) { - ObDereferenceObject(RootKey); return FALSE; }