[KMTESTS:IO] Correctly free name in IoFilesystem's TestAllInformation.
authorThomas Faber <thomas.faber@reactos.org>
Sun, 18 Feb 2018 13:05:10 +0000 (14:05 +0100)
committerThomas Faber <thomas.faber@reactos.org>
Sun, 18 Feb 2018 13:14:54 +0000 (14:14 +0100)
Spotted by Serge Gautherie.

modules/rostests/kmtests/ntos_io/IoFilesystem.c

index 65c7635..c974b8c 100644 (file)
@@ -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);
 }