Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit
Swift apple-silicond3dmetaldxmtdxvkgame-porting-toolkitgptkmac-gamingmacosmetalfxrosetta-2steamsteam-playwinewinecx
diff --git a/dlls/winebus.sys/main.c b/dlls/winebus.sys/main.c
index 88d21b47..5f501c72 100644
--- a/dlls/winebus.sys/main.c
+++ b/dlls/winebus.sys/main.c
@@ -1118,17 +1118,21 @@ static void sdl_bus_load_mappings(struct bus_options *options)
RtlUnicodeToMultiByteSize(&len, (WCHAR *)((char *)info + info->DataOffset), info_size - info->DataOffset);
if (!len) continue;
- if (!(mappings[count++] = RtlAllocateHeap(GetProcessHeap(), 0, len + 1))) break;
- if (count > capacity)
+ if (count == capacity)
{
+ char **grown;
+
capacity = capacity * 3 / 2;
- if (!(mappings = RtlReAllocateHeap(GetProcessHeap(), 0, mappings, capacity * sizeof(*mappings))))
+ if (!(grown = RtlReAllocateHeap(GetProcessHeap(), 0, mappings, capacity * sizeof(*mappings))))
break;
+ mappings = grown;
}
+ if (!(mappings[count] = RtlAllocateHeap(GetProcessHeap(), 0, len + 1))) break;
RtlUnicodeToMultiByteN(mappings[count], len, NULL, (WCHAR *)((char *)info + info->DataOffset),
info_size - info->DataOffset);
- if (mappings[len - 1]) mappings[len] = 0;
+ mappings[count][len] = 0;
+ count++;
}
if (mappings) while (count) RtlFreeHeap(GetProcessHeap(), 0, mappings[--count]);