aboutsummaryrefslogtreecommitdiffstats
path: root/src/audio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio.c')
-rw-r--r--src/audio.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/audio.c b/src/audio.c
index b868edb30..7c430b326 100644
--- a/src/audio.c
+++ b/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)