In case of failure, ObInsertObject itself dereferences the object, so calling ObDereferenceObject one more time in the failure handler is redundant.
- Remove ObDereferenceObject call from CmpCreateRegistryRoot in case ObInsertObject fails.
- Add missing RootKey dereference if CmpCreateRegistryRoot failed to get the key cell (KeyCell).
CORE-17904
/* 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");
&CmpRegistryRootHandle);
if (!NT_SUCCESS(Status))
{
- ObDereferenceObject(RootKey);
return FALSE;
}