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().
This commit is contained in:
parent
8d1801c59d
commit
5d0a8ce3af
11
src/audio.c
11
src/audio.c
|
@ -386,11 +386,12 @@ void closeAudioDevice(void)
|
|||
{
|
||||
unsigned int i;
|
||||
|
||||
flushAudioBuffer();
|
||||
|
||||
free(audio_buffer.buffer);
|
||||
audio_buffer.buffer = NULL;
|
||||
audio_buffer.size = 0;
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue