diff options
author | Chris Robinson <[email protected]> | 2010-03-15 16:10:21 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2010-03-15 16:10:21 -0700 |
commit | 89d84131a46f0aa528eb0d3adbe0798cd4304b4e (patch) | |
tree | 92e003f1a8198e4f679b7487e584621d4d3051f2 | |
parent | 2033f60d247ec0d3fe0595429581fe0dcfe7bbf4 (diff) |
Avoid dereferencing a NULL buffer when unqueueing buffer 0
-rw-r--r-- | OpenAL32/alSource.c | 10 |
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); |