From 89d84131a46f0aa528eb0d3adbe0798cd4304b4e Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 15 Mar 2010 16:10:21 -0700 Subject: Avoid dereferencing a NULL buffer when unqueueing buffer 0 --- OpenAL32/alSource.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'OpenAL32') diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index cf859e00..e7c51a66 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -1748,11 +1748,15 @@ ALAPI ALvoid ALAPIENTRY alSourceUnqueueBuffers( ALuint source, ALsizei n, ALuint ALBufferList = ALSource->queue; ALSource->queue = ALBufferList->next; - // Record name of buffer - buffers[i] = ALBufferList->buffer->buffer; - // Decrement buffer reference counter if(ALBufferList->buffer) + { + // Record name of buffer + buffers[i] = ALBufferList->buffer->buffer; + // Decrement buffer reference counter ALBufferList->buffer->refcount--; + } + else + buffers[i] = 0; // Release memory for buffer list item free(ALBufferList); -- cgit v1.2.3