diff options
-rw-r--r-- | OpenAL32/alBuffer.c | 22 | ||||
-rw-r--r-- | OpenAL32/alSource.c | 24 |
2 files changed, 23 insertions, 23 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 { diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c index 746ec821..4cafe190 100644 --- a/OpenAL32/alSource.c +++ b/OpenAL32/alSource.c @@ -65,22 +65,22 @@ ALAPI ALvoid ALAPIENTRY alGenSources(ALsizei n,ALuint *sources) while(i < n) { *list = calloc(1, sizeof(ALsource)); - if(*list) + if(!(*list)) { - sources[i]=(ALuint)ALTHUNK_ADDENTRY(*list); - (*list)->source = sources[i]; + alDeleteSources(i, sources); + alSetError(AL_OUT_OF_MEMORY); + break; + } - InitSourceParams(*list); - Context->SourceCount++; - i++; + sources[i] = (ALuint)ALTHUNK_ADDENTRY(*list); + (*list)->source = sources[i]; - list = &(*list)->next; - } - } + InitSourceParams(*list); + Context->SourceCount++; + i++; - // If we didn't create all the Sources, we must have run out or memory - if(i != n) - alSetError(AL_OUT_OF_MEMORY); + list = &(*list)->next; + } } else { |