Fix NULL access crashes on ALSA MIDI close
This commit is contained in:
@@ -298,14 +298,17 @@ void plat_midi_input_init(void)
|
|||||||
|
|
||||||
void plat_midi_input_close(void)
|
void plat_midi_input_close(void)
|
||||||
{
|
{
|
||||||
thread_wait_mutex(midiinmtx);
|
if (midiinmtx) thread_wait_mutex(midiinmtx);
|
||||||
if (midiin != NULL)
|
if (midiin != NULL)
|
||||||
{
|
{
|
||||||
snd_rawmidi_close(midiin);
|
snd_rawmidi_close(midiin);
|
||||||
midiin = NULL;
|
midiin = NULL;
|
||||||
}
|
}
|
||||||
thread_release_mutex(midiinmtx);
|
if (midiinmtx)
|
||||||
thread_close_mutex(midiinmtx);
|
{
|
||||||
|
thread_release_mutex(midiinmtx);
|
||||||
|
thread_close_mutex(midiinmtx);
|
||||||
|
}
|
||||||
midiinmtx = NULL;
|
midiinmtx = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user