[KMTESTS:IO] Correctly free name in IoFilesystem's TestAllInformation.

Spotted by Serge Gautherie.
This commit is contained in:
Thomas Faber 2018-02-18 14:05:10 +01:00
parent 9bc2a27393
commit 0cc3f19b80
No known key found for this signature in database
GPG key ID: 076E7C3D44720826

View file

@ -73,7 +73,7 @@ TestAllInformation(VOID)
PFILE_ALL_INFORMATION FileAllInfo; PFILE_ALL_INFORMATION FileAllInfo;
SIZE_T Length; SIZE_T Length;
ULONG NameLength; ULONG NameLength;
PWCHAR Name = NULL; PWCHAR Name;
UNICODE_STRING NamePart; UNICODE_STRING NamePart;
InitializeObjectAttributes(&ObjectAttributes, InitializeObjectAttributes(&ObjectAttributes,
@ -161,6 +161,7 @@ TestAllInformation(VOID)
ok(RtlEqualUnicodeString(&NamePart, &Ntoskrnl, TRUE), ok(RtlEqualUnicodeString(&NamePart, &Ntoskrnl, TRUE),
"Name ends in '%wZ', expected %wZ\n", &NamePart, &Ntoskrnl); "Name ends in '%wZ', expected %wZ\n", &NamePart, &Ntoskrnl);
} }
ExFreePoolWithTag(Name, 'sFmK');
} }
ok(FileAllInfo->NameInformation.FileName[NameLength / sizeof(WCHAR)] == 0xdddd, ok(FileAllInfo->NameInformation.FileName[NameLength / sizeof(WCHAR)] == 0xdddd,
"Char past FileName is %x\n", "Char past FileName is %x\n",
@ -209,8 +210,6 @@ TestAllInformation(VOID)
if (FileAllInfo) if (FileAllInfo)
KmtFreeGuarded(FileAllInfo); KmtFreeGuarded(FileAllInfo);
ExFreePoolWithTag(Name, 'sFmK');
Status = ObCloseHandle(FileHandle, KernelMode); Status = ObCloseHandle(FileHandle, KernelMode);
ok_eq_hex(Status, STATUS_SUCCESS); ok_eq_hex(Status, STATUS_SUCCESS);
} }