aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2010-03-15 16:10:21 -0700
committerChris Robinson <[email protected]>2010-03-15 16:10:21 -0700
commit89d84131a46f0aa528eb0d3adbe0798cd4304b4e (patch)
tree92e003f1a8198e4f679b7487e584621d4d3051f2 /OpenAL32
parent2033f60d247ec0d3fe0595429581fe0dcfe7bbf4 (diff)
Avoid dereferencing a NULL buffer when unqueueing buffer 0
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/alSource.c10
1 files changed, 7 insertions, 3 deletions
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);