From f12855143939e28d9912991674a58129dfb8f884 Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Wed, 13 Feb 2013 23:44:39 +0100 Subject: [PATCH] wineoss.drv: Use offsetof to calculate the size of a struct with variable length array. --- dlls/wineoss.drv/midi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dlls/wineoss.drv/midi.c b/dlls/wineoss.drv/midi.c index 0bf5d879ed1..11b7c917d9c 100644 --- a/dlls/wineoss.drv/midi.c +++ b/dlls/wineoss.drv/midi.c @@ -1115,8 +1115,7 @@ static DWORD modOpen(WORD wDevID, LPMIDIOPENDESC lpDesc, DWORD dwFlags) void* extra; extra = HeapAlloc(GetProcessHeap(), 0, - sizeof(struct sFMextra) + - sizeof(struct sVoice) * (MidiOutDev[wDevID].caps.wVoices - 1)); + offsetof(struct sFMextra, voice[MidiOutDev[wDevID].caps.wVoices])); if (extra == 0) { WARN("can't alloc extra data !\n"); -- 2.11.4.GIT