From 0cc3f19b805860f393d08915d6dbd053439da7f3 Mon Sep 17 00:00:00 2001 From: Thomas Faber Date: Sun, 18 Feb 2018 14:05:10 +0100 Subject: [PATCH] [KMTESTS:IO] Correctly free name in IoFilesystem's TestAllInformation. Spotted by Serge Gautherie. --- modules/rostests/kmtests/ntos_io/IoFilesystem.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/rostests/kmtests/ntos_io/IoFilesystem.c b/modules/rostests/kmtests/ntos_io/IoFilesystem.c index 65c76352d21..c974b8cf643 100644 --- a/modules/rostests/kmtests/ntos_io/IoFilesystem.c +++ b/modules/rostests/kmtests/ntos_io/IoFilesystem.c @@ -73,7 +73,7 @@ TestAllInformation(VOID) PFILE_ALL_INFORMATION FileAllInfo; SIZE_T Length; ULONG NameLength; - PWCHAR Name = NULL; + PWCHAR Name; UNICODE_STRING NamePart; InitializeObjectAttributes(&ObjectAttributes, @@ -161,6 +161,7 @@ TestAllInformation(VOID) ok(RtlEqualUnicodeString(&NamePart, &Ntoskrnl, TRUE), "Name ends in '%wZ', expected %wZ\n", &NamePart, &Ntoskrnl); } + ExFreePoolWithTag(Name, 'sFmK'); } ok(FileAllInfo->NameInformation.FileName[NameLength / sizeof(WCHAR)] == 0xdddd, "Char past FileName is %x\n", @@ -209,8 +210,6 @@ TestAllInformation(VOID) if (FileAllInfo) KmtFreeGuarded(FileAllInfo); - ExFreePoolWithTag(Name, 'sFmK'); - Status = ObCloseHandle(FileHandle, KernelMode); ok_eq_hex(Status, STATUS_SUCCESS); }