https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b43e4c981e41f26726fe2…
commit b43e4c981e41f26726fe214cacde7d7ec5738907
Author: Michael Stamper <michaelstamper1(a)gmail.com>
AuthorDate: Mon Sep 14 20:48:06 2020 +0100
Commit: GitHub <noreply(a)github.com>
CommitDate: Mon Sep 14 21:48:06 2020 +0200
[KDBG] Fixed handle leak in KdbpSymLoadModuleSymbols() when RosSymCreateFromFile()
fails (#3184)
---
ntoskrnl/kdbg/kdb_symbols.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/ntoskrnl/kdbg/kdb_symbols.c b/ntoskrnl/kdbg/kdb_symbols.c
index 1b2d8f695c8..3baafaf7b78 100644
--- a/ntoskrnl/kdbg/kdb_symbols.c
+++ b/ntoskrnl/kdbg/kdb_symbols.c
@@ -363,6 +363,7 @@ KdbpSymLoadModuleSymbols(
HANDLE FileHandle;
NTSTATUS Status;
IO_STATUS_BLOCK IoStatusBlock;
+ BOOLEAN Result;
/* Allow KDB to break on module load */
KdbModuleLoaded(FileName);
@@ -404,14 +405,15 @@ KdbpSymLoadModuleSymbols(
DPRINT("Loading symbols from %wZ...\n", FileName);
- if (!RosSymCreateFromFile(&FileHandle, RosSymInfo))
+ Result = RosSymCreateFromFile(&FileHandle, RosSymInfo);
+ ZwClose(FileHandle);
+
+ if (!Result)
{
DPRINT("Failed to load symbols from %wZ\n", FileName);
return;
}
- ZwClose(FileHandle);
-
DPRINT("Symbols loaded.\n");
/* add file to cache */