aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alBuffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'OpenAL32/alBuffer.c')
-rw-r--r--OpenAL32/alBuffer.c22
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
{