foxygit / doom Log in
commit 580abf9ead2b773c5314c08c50250bdba562a3dd
Author:     Roman Fomin <rfomin@gmail.com>
AuthorDate: Tue Nov 28 00:25:49 2023 +0700
Commit:     Roman Fomin <rfomin@gmail.com>
CommitDate: Tue Nov 28 00:25:49 2023 +0700

    Return from StreamOut if midiOutPrepareHeader failed, add comment
---
 src/i_winmusic.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/i_winmusic.c b/src/i_winmusic.c
index 63a30c74..0f6d47fc 100644
--- a/src/i_winmusic.c
+++ b/src/i_winmusic.c
@@ -222,6 +222,9 @@ static void UnprepareHeader(void)
 #endif
 }

+// Allocate buffer. The calling thread must have exclusive access to the shared
+// resources in this function.
+
 static void AllocateBuffer(const unsigned int size)
 {
     buffer.size = PADDED_SIZE(size);
@@ -277,6 +280,7 @@ static void StreamOut(void)
     if (mmr != MMSYSERR_NOERROR)
     {
         MidiError("midiOutPrepareHeader", mmr);
+        return;
     }

     buffer.prepared = true;