Fix NULL access crashes on ALSA MIDI close

This commit is contained in:
Cacodemon345
2021-09-07 23:30:44 +06:00
committed by GitHub
parent 81051f33e0
commit eea72da77b

View File

@@ -298,14 +298,17 @@ void plat_midi_input_init(void)
void plat_midi_input_close(void)
{
thread_wait_mutex(midiinmtx);
if (midiinmtx) thread_wait_mutex(midiinmtx);
if (midiin != NULL)
{
snd_rawmidi_close(midiin);
midiin = NULL;
}
thread_release_mutex(midiinmtx);
thread_close_mutex(midiinmtx);
if (midiinmtx)
{
thread_release_mutex(midiinmtx);
thread_close_mutex(midiinmtx);
}
midiinmtx = NULL;
}