[KERNEL32]
authorJohannes Anderwald <johannes.anderwald@reactos.org>
Fri, 13 Nov 2009 17:31:02 +0000 (17:31 +0000)
committerJohannes Anderwald <johannes.anderwald@reactos.org>
Fri, 13 Nov 2009 17:31:02 +0000 (17:31 +0000)
- Don't access freed memory in GetVolumeNameForVolumeMountPointW

svn path=/trunk/; revision=44141

reactos/dll/win32/kernel32/file/volume.c

index 09e07ab..0283def 100644 (file)
@@ -996,15 +996,16 @@ GetVolumeNameForVolumeMountPointW(
                                      MountPoints, BufferLength);
       if (!NT_SUCCESS(Status))
       {
-         RtlFreeHeap(RtlGetProcessHeap(), 0, MountPoints);
          if (Status == STATUS_BUFFER_OVERFLOW)
          {
             BufferLength = MountPoints->Size;
+            RtlFreeHeap(RtlGetProcessHeap(), 0, MountPoints);
             continue;
          }
          else if (!NT_SUCCESS(Status))
          {
             RtlFreeHeap(RtlGetProcessHeap(), 0, MountPoint);
+            RtlFreeHeap(RtlGetProcessHeap(), 0, MountPoints);
             NtClose(FileHandle);
             SetLastErrorByStatus(Status);
             return FALSE;