From cff5149ecac89a37df127ff5fb808b9cf0c78def Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Fri, 9 Jan 2004 19:42:40 +0000 Subject: [PATCH] Do not dereference key objects if they are used to link hives. svn path=/trunk/; revision=7526 --- reactos/ntoskrnl/cm/registry.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/reactos/ntoskrnl/cm/registry.c b/reactos/ntoskrnl/cm/registry.c index bae070c4d64..329ead702e0 100644 --- a/reactos/ntoskrnl/cm/registry.c +++ b/reactos/ntoskrnl/cm/registry.c @@ -1,4 +1,4 @@ -/* $Id: registry.c,v 1.117 2004/01/08 15:02:45 ekohl Exp $ +/* $Id: registry.c,v 1.118 2004/01/09 19:42:40 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -622,7 +622,7 @@ CmiConnectHive(IN POBJECT_ATTRIBUTES KeyObjectAttributes, VERIFY_KEY_OBJECT(NewKey); - ObDereferenceObject (NewKey); + /* Note: Do not dereference NewKey here! */ ObDereferenceObject (ParentKey); return STATUS_SUCCESS; @@ -725,6 +725,8 @@ CmiDisconnectHive (IN POBJECT_ATTRIBUTES KeyObjectAttributes, Entry = Entry->Flink; } + /* Note: Dereference the key object twice in order to delete it */ + ObDereferenceObject (KeyObject); ObDereferenceObject (KeyObject); *RegistryHive = Hive;