From d9cd45cd0a0eb70b110c3656f0f61739bccaf356 Mon Sep 17 00:00:00 2001 From: Brad Harding Date: Sun, 6 Oct 2024 12:47:40 +1100 Subject: [PATCH] Bring back midiOutPrepareHeader(), but check for ASan --- src/i_winmusic.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/i_winmusic.c b/src/i_winmusic.c index e56c3967c..a3b08db6c 100644 --- a/src/i_winmusic.c +++ b/src/i_winmusic.c @@ -490,10 +490,20 @@ void I_Windows_UnregisterSong(void) void I_Windows_ShutdownMusic(void) { +#if !defined(__SANITIZE_ADDRESS__) + MMRESULT mmr; +#endif + I_Windows_StopSong(); I_Windows_UnregisterSong(); - //midiOutUnprepareHeader((HMIDIOUT)hMidiStream, &buffer.MidiStreamHdr, sizeof(MIDIHDR)); +#if !defined(__SANITIZE_ADDRESS__) + if ((mmr = midiOutUnprepareHeader((HMIDIOUT)hMidiStream, &buffer.MidiStreamHdr, sizeof(MIDIHDR))) != MMSYSERR_NOERROR) + { + MidiErrorMessage(mmr); + return; + } +#endif midiStreamClose(hMidiStream);