Commit 5d0a8ce3 authored by Max Kellermann's avatar Max Kellermann

audio: don't free uninitialized audio_buffer

free(NULL) isn't explicitly forbidden, but isn't exactly good style. Check the rare case that the audio buffer isn't initialized yet in closeAudioDevice(). In this case, we also don't have to call flushAudioBuffer().
parent 8d1801c5
......@@ -386,11 +386,12 @@ void closeAudioDevice(void)
{
unsigned int i;
if (audio_buffer.buffer != NULL) {
flushAudioBuffer();
free(audio_buffer.buffer);
audio_buffer.buffer = NULL;
audio_buffer.size = 0;
}
for (i = 0; i < audioOutputArraySize; ++i) {
if (audioDeviceStates[i] == DEVICE_ON)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment