https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ccf8bff3ecfb92c1be6c4…
commit ccf8bff3ecfb92c1be6c4997107a2249a8f43341
Author: Serge Gautherie <32623169+SergeGautherie(a)users.noreply.github.com>
AuthorDate: Sun Jul 14 00:32:23 2019 +0200
Commit: Hermès BÉLUSCA - MAÏTO <hermes.belusca-maito(a)reactos.org>
CommitDate: Sun Jul 14 00:32:23 2019 +0200
[NTOS:MM] Fix MmGetFileNameForAddress() callers. (#1723)
MmGetFileNameForAddress() calls RtlCreateUnicodeString().
This also fixes a leak in MiQueryMemorySectionName().
---
ntoskrnl/dbgk/dbgkobj.c | 2 +-
ntoskrnl/mm/ARM3/section.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/ntoskrnl/dbgk/dbgkobj.c b/ntoskrnl/dbgk/dbgkobj.c
index 3f03e9b9031..c8126feb7d0 100644
--- a/ntoskrnl/dbgk/dbgkobj.c
+++ b/ntoskrnl/dbgk/dbgkobj.c
@@ -558,7 +558,7 @@ DbgkpPostFakeModuleMessages(IN PEPROCESS Process,
if (!NT_SUCCESS(Status)) LoadDll->FileHandle = NULL;
/* Free the name now */
- ExFreePool(ModuleName.Buffer);
+ RtlFreeUnicodeString(&ModuleName);
}
/* Send the fake module load message */
diff --git a/ntoskrnl/mm/ARM3/section.c b/ntoskrnl/mm/ARM3/section.c
index fdda46d3afa..e50aa518e5d 100644
--- a/ntoskrnl/mm/ARM3/section.c
+++ b/ntoskrnl/mm/ARM3/section.c
@@ -1897,7 +1897,6 @@ MiQueryMemorySectionName(IN HANDLE ProcessHandle,
{
PEPROCESS Process;
NTSTATUS Status;
- WCHAR ModuleFileNameBuffer[MAX_PATH] = {0};
UNICODE_STRING ModuleFileName;
PMEMORY_SECTION_NAME SectionName = NULL;
KPROCESSOR_MODE PreviousMode = ExGetPreviousMode();
@@ -1915,7 +1914,6 @@ MiQueryMemorySectionName(IN HANDLE ProcessHandle,
return Status;
}
- RtlInitEmptyUnicodeString(&ModuleFileName, ModuleFileNameBuffer,
sizeof(ModuleFileNameBuffer));
Status = MmGetFileNameForAddress(BaseAddress, &ModuleFileName);
if (NT_SUCCESS(Status))
@@ -1947,6 +1945,8 @@ MiQueryMemorySectionName(IN HANDLE ProcessHandle,
if (ReturnLength) *ReturnLength = ModuleFileName.Length;
}
+
+ RtlFreeUnicodeString(&ModuleFileName);
}
ObDereferenceObject(Process);
return Status;