From 5a56a7c2da315f097ea39b26eb1a3c1ba5694d5c Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Fri, 13 Nov 2009 17:31:02 +0000 Subject: [PATCH] [KERNEL32] - Don't access freed memory in GetVolumeNameForVolumeMountPointW svn path=/trunk/; revision=44141 --- reactos/dll/win32/kernel32/file/volume.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reactos/dll/win32/kernel32/file/volume.c b/reactos/dll/win32/kernel32/file/volume.c index 09e07ab5883..0283def92cf 100644 --- a/reactos/dll/win32/kernel32/file/volume.c +++ b/reactos/dll/win32/kernel32/file/volume.c @@ -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;