Michael Stefaniuc : wineoss.drv: Use offsetof to calculate the size of a struct with variable length array.
Module: wine Branch: master Commit: f12855143939e28d9912991674a58129dfb8f884 URL: http://source.winehq.org/git/wine.git/?a=commit;h=f12855143939e28d9912991674... Author: Michael Stefaniuc <mstefani(a)redhat.de> Date: Wed Feb 13 23:44:39 2013 +0100 wineoss.drv: Use offsetof to calculate the size of a struct with variable length array. --- dlls/wineoss.drv/midi.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/dlls/wineoss.drv/midi.c b/dlls/wineoss.drv/midi.c index 0bf5d87..11b7c91 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");
participants (1)
-
Alexandre Julliard