aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alBuffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'OpenAL32/alBuffer.c')
-rw-r--r--OpenAL32/alBuffer.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c
index 29f3e617..41444ac2 100644
--- a/OpenAL32/alBuffer.c
+++ b/OpenAL32/alBuffer.c
@@ -198,7 +198,10 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *buffers)
{
ALbuffer *buffer = calloc(1, sizeof(ALbuffer));
if(!buffer)
+ {
+ alDeleteBuffers(cur, buffers);
al_throwerr(Context, AL_OUT_OF_MEMORY);
+ }
RWLockInit(&buffer->lock);
err = NewThunkEntry(&buffer->id);
@@ -210,17 +213,13 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *buffers)
memset(buffer, 0, sizeof(ALbuffer));
free(buffer);
+ alDeleteBuffers(cur, buffers);
al_throwerr(Context, err);
}
buffers[cur] = buffer->id;
}
}
- al_catchany()
- {
- if(cur > 0)
- alDeleteBuffers(cur, buffers);
- }
al_endtry;
ALCcontext_DecRef(Context);