Skip to content

Commit

Permalink
Free the buffer queue pool when closing the audio device.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Apr 17, 2018
1 parent 6b8a554 commit 58b10e4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mojoal.c
Expand Up @@ -415,6 +415,7 @@ ALCdevice *alcOpenDevice(const ALCchar *devicename)
ALCboolean alcCloseDevice(ALCdevice *device)
{
BufferBlock *bb;
BufferQueueItem *item;

if (!device || device->iscapture) {
return ALC_FALSE;
Expand Down Expand Up @@ -445,6 +446,13 @@ ALCboolean alcCloseDevice(ALCdevice *device)
bb = next;
}

item = (BufferQueueItem *) device->playback.buffer_queue_pool;
while (item) {
BufferQueueItem *next = item->next;
SDL_free(item);
item = next;
}

SDL_free(device->name);
SDL_free(device);
SDL_QuitSubSystem(SDL_INIT_AUDIO);
Expand Down

0 comments on commit 58b10e4

Please sign in to comment.