diff options
author | Chris Robinson <[email protected]> | 2008-01-15 16:30:43 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2008-01-15 16:30:43 -0800 |
commit | a11f25e47b36364aa3e284640ee8f15aaa266de8 (patch) | |
tree | bdd16ec6c5272467a1a4f93057166b3c558195b1 /OpenAL32/alBuffer.c | |
parent | a6213ebfc75da6428849083d57e57dec3f8670a3 (diff) |
Fix source and buffer out-of-memory conditions
Diffstat (limited to 'OpenAL32/alBuffer.c')
-rw-r--r-- | OpenAL32/alBuffer.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c index f9017caa..2a288b85 100644 --- a/OpenAL32/alBuffer.c +++ b/OpenAL32/alBuffer.c @@ -95,20 +95,20 @@ ALAPI ALvoid ALAPIENTRY alGenBuffers(ALsizei n,ALuint *puiBuffers) while(i < n) { *list = calloc(1, sizeof(ALbuffer)); - if(*list) + if(!(*list)) { - puiBuffers[i] = (ALuint)ALTHUNK_ADDENTRY(*list); - (*list)->state = UNUSED; - g_uiBufferCount++; - i++; - - list = &(*list)->next; + alDeleteBuffers(i, puiBuffers); + alSetError(AL_OUT_OF_MEMORY); + break; } - } - // If we didn't create all the Buffers, we must have run out of memory - if (i != n) - alSetError(AL_OUT_OF_MEMORY); + puiBuffers[i] = (ALuint)ALTHUNK_ADDENTRY(*list); + (*list)->state = UNUSED; + g_uiBufferCount++; + i++; + + list = &(*list)->next; + } } else { |