aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alAuxEffectSlot.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2010-03-20 21:38:05 -0700
committerChris Robinson <[email protected]>2010-03-20 21:38:05 -0700
commit99f28f25b07e28415ce58fd552dcadf2a187c3e3 (patch)
tree45f9ca387fd88b95b013b022d91b004f6ffed91c /OpenAL32/alAuxEffectSlot.c
parent27358c8ce8dcb9bc6d18c10b652784f068cb2ec2 (diff)
Avoid calling alDelete* from alGen*
Diffstat (limited to 'OpenAL32/alAuxEffectSlot.c')
-rw-r--r--OpenAL32/alAuxEffectSlot.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c
index bc381bf6..5c49821a 100644
--- a/OpenAL32/alAuxEffectSlot.c
+++ b/OpenAL32/alAuxEffectSlot.c
@@ -40,7 +40,7 @@ DECL_VERIFIER(Effect, ALeffect, effect)
ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots)
{
ALCcontext *Context;
- ALsizei i, j;
+ ALsizei i=0, j;
Context = GetContextSuspended();
if(!Context) return;
@@ -54,11 +54,12 @@ ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots)
// Check that enough memory has been allocted in the 'effectslots' array for n Effect Slots
if (!IsBadWritePtr((void*)effectslots, n * sizeof(ALuint)))
{
+ ALeffectslot *end;
ALeffectslot **list = &Context->EffectSlotList;
while(*list)
list = &(*list)->next;
- i = 0;
+ end = *list;
while(i < n)
{
*list = calloc(1, sizeof(ALeffectslot));
@@ -66,7 +67,16 @@ ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots)
{
// We must have run out or memory
free(*list); *list = NULL;
- alDeleteAuxiliaryEffectSlots(i, effectslots);
+ while(end->next)
+ {
+ ALeffectslot *temp = end->next;
+ end->next = temp->next;
+
+ ALEffect_Destroy(temp->EffectState);
+ ALTHUNK_REMOVEENTRY(temp->effectslot);
+ Context->EffectSlotCount--;
+ free(temp);
+ }
alSetError(Context, AL_OUT_OF_MEMORY);
break;
}