diff options
author | Chris Robinson <[email protected]> | 2010-03-20 21:38:05 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2010-03-20 21:38:05 -0700 |
commit | 99f28f25b07e28415ce58fd552dcadf2a187c3e3 (patch) | |
tree | 45f9ca387fd88b95b013b022d91b004f6ffed91c /OpenAL32/alBuffer.c | |
parent | 27358c8ce8dcb9bc6d18c10b652784f068cb2ec2 (diff) |
Avoid calling alDelete* from alGen*
Diffstat (limited to 'OpenAL32/alBuffer.c')
-rw-r--r-- | OpenAL32/alBuffer.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c index 071e56fe..eaf508af 100644 --- a/OpenAL32/alBuffer.c +++ b/OpenAL32/alBuffer.c @@ -120,17 +120,27 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n,ALuint *puiBuffers) // Check the pointer is valid (and points to enough memory to store Buffer Names) if (!IsBadWritePtr((void*)puiBuffers, n * sizeof(ALuint))) { + ALbuffer *end; ALbuffer **list = &device->BufferList; while(*list) list = &(*list)->next; // Create all the new Buffers + end = *list; while(i < n) { *list = calloc(1, sizeof(ALbuffer)); if(!(*list)) { - alDeleteBuffers(i, puiBuffers); + while(end->next) + { + ALbuffer *temp = end->next; + end->next = temp->next; + + ALTHUNK_REMOVEENTRY(temp->buffer); + device->BufferCount--; + free(temp); + } alSetError(Context, AL_OUT_OF_MEMORY); break; } |