From: Amine Khaldi Date: Thu, 26 Jun 2014 19:35:48 +0000 (+0000) Subject: [NTOS:CM] X-Git-Tag: backups/0.3.17@66124~954 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=2c9a27ae40e4d2117a800a98cbdcdb4a47877649;ds=sidebyside [NTOS:CM] * Plug some leaks. Inspired by CID 1206912 and fixed by Timo. CORE-7975 svn path=/trunk/; revision=63647 --- diff --git a/reactos/ntoskrnl/config/cmsysini.c b/reactos/ntoskrnl/config/cmsysini.c index 4201fd2f6a7..f41d27b042c 100644 --- a/reactos/ntoskrnl/config/cmsysini.c +++ b/reactos/ntoskrnl/config/cmsysini.c @@ -1052,7 +1052,11 @@ CmpCreateRegistryRoot(VOID) NULL, 0, &KeyName); - if (!Kcb) return FALSE; + if (!Kcb) + { + ObDereferenceObject(RootKey); + return FALSE; + } /* Initialize the object */ RootKey->KeyControlBlock = Kcb; @@ -1070,7 +1074,11 @@ CmpCreateRegistryRoot(VOID) 0, NULL, &CmpRegistryRootHandle); - if (!NT_SUCCESS(Status)) return FALSE; + if (!NT_SUCCESS(Status)) + { + ObDereferenceObject(RootKey); + return FALSE; + } /* Reference the key again so that we never lose it */ Status = ObReferenceObjectByHandle(CmpRegistryRootHandle, @@ -1079,7 +1087,11 @@ CmpCreateRegistryRoot(VOID) KernelMode, (PVOID*)&RootKey, NULL); - if (!NT_SUCCESS(Status)) return FALSE; + if (!NT_SUCCESS(Status)) + { + ObDereferenceObject(RootKey); + return FALSE; + } /* Completely sucessful */ return TRUE;