Sync to trunk head (r42241)
[reactos.git] / reactos / dll / win32 / kernel32 / misc / stubs.c
index 4a58567..0cb8241 100644 (file)
@@ -661,9 +661,15 @@ FindNextVolumeA(HANDLE handle,
                 LPSTR volume,
                 DWORD len)
 {
-    WCHAR *buffer = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+    WCHAR *buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, len * sizeof(WCHAR));
     BOOL ret;
 
+    if (!buffer)
+    {
+        SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+        return FALSE;
+    }
+
     if ((ret = FindNextVolumeW( handle, buffer, len )))
     {
         if (!WideCharToMultiByte( CP_ACP, 0, buffer, -1, volume, len, NULL, NULL )) ret = FALSE;