From 49db3bf9166ccf5193e032acf1d810758fab267f Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 20 Mar 2010 21:49:02 -0700 Subject: Cleanup and fixup Release* functions --- OpenAL32/alDatabuffer.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'OpenAL32/alDatabuffer.c') diff --git a/OpenAL32/alDatabuffer.c b/OpenAL32/alDatabuffer.c index f13bc34e..df31e6f7 100644 --- a/OpenAL32/alDatabuffer.c +++ b/OpenAL32/alDatabuffer.c @@ -650,21 +650,18 @@ ALvoid AL_APIENTRY alUnmapDatabufferEXT(ALuint uiBuffer) */ ALvoid ReleaseALDatabuffers(ALCdevice *device) { - ALdatabuffer *ALBuffer; - ALdatabuffer *ALBufferTemp; - - ALBuffer = device->DatabufferList; - while(ALBuffer) + while(device->DatabufferList) { - // Release sample data - free(ALBuffer->data); + ALdatabuffer *temp = device->DatabufferList; + device->DatabufferList = temp->next; + + // Release buffer data + free(temp->data); // Release Buffer structure - ALBufferTemp = ALBuffer; - ALBuffer = ALBuffer->next; - memset(ALBufferTemp, 0, sizeof(ALdatabuffer)); - free(ALBufferTemp); + ALTHUNK_REMOVEENTRY(temp->databuffer); + memset(temp, 0, sizeof(ALdatabuffer)); + free(temp); } - device->DatabufferList = NULL; device->DatabufferCount = 0; } -- cgit v1.2.3