https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0cc3f19b805860f393d08915d6dbd053439da7f3

commit 0cc3f19b805860f393d08915d6dbd053439da7f3
Author:     Thomas Faber <thomas.fa...@reactos.org>
AuthorDate: Sun Feb 18 14:05:10 2018 +0100
Commit:     Thomas Faber <thomas.fa...@reactos.org>
CommitDate: Sun Feb 18 14:14:54 2018 +0100

    [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 65c76352d2..c974b8cf64 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);
 }

Reply via email to