From 99f28f25b07e28415ce58fd552dcadf2a187c3e3 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 20 Mar 2010 21:38:05 -0700 Subject: Avoid calling alDelete* from alGen* --- OpenAL32/alDatabuffer.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'OpenAL32/alDatabuffer.c') diff --git a/OpenAL32/alDatabuffer.c b/OpenAL32/alDatabuffer.c index 1f5302e6..f13bc34e 100644 --- a/OpenAL32/alDatabuffer.c +++ b/OpenAL32/alDatabuffer.c @@ -56,17 +56,27 @@ ALvoid AL_APIENTRY alGenDatabuffersEXT(ALsizei n,ALuint *puiBuffers) * Databuffer Names) */ if(!IsBadWritePtr((void*)puiBuffers, n * sizeof(ALuint))) { + ALdatabuffer *end; ALdatabuffer **list = &device->DatabufferList; while(*list) list = &(*list)->next; /* Create all the new Databuffers */ + end = *list; while(i < n) { *list = calloc(1, sizeof(ALdatabuffer)); if(!(*list)) { - alDeleteDatabuffersEXT(i, puiBuffers); + while(end->next) + { + ALdatabuffer *temp = end->next; + end->next = temp->next; + + ALTHUNK_REMOVEENTRY(temp->databuffer); + device->DatabufferCount--; + free(temp); + } alSetError(Context, AL_OUT_OF_MEMORY); break; } -- cgit v1.2.3