aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alEffect.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/alEffect.c
parent27358c8ce8dcb9bc6d18c10b652784f068cb2ec2 (diff)
Avoid calling alDelete* from alGen*
Diffstat (limited to 'OpenAL32/alEffect.c')
-rw-r--r--OpenAL32/alEffect.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c
index 7241de2c..a63ea72e 100644
--- a/OpenAL32/alEffect.c
+++ b/OpenAL32/alEffect.c
@@ -41,7 +41,7 @@ DECL_VERIFIER(Effect, ALeffect, effect)
ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects)
{
ALCcontext *Context;
- ALsizei i;
+ ALsizei i=0;
Context = GetContextSuspended();
if(!Context) return;
@@ -53,18 +53,26 @@ ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects)
// Check that enough memory has been allocted in the 'effects' array for n Effects
if (!IsBadWritePtr((void*)effects, n * sizeof(ALuint)))
{
+ ALeffect *end;
ALeffect **list = &device->EffectList;
while(*list)
list = &(*list)->next;
- i = 0;
+ end = *list;
while(i < n)
{
*list = calloc(1, sizeof(ALeffect));
if(!(*list))
{
- // We must have run out or memory
- alDeleteEffects(i, effects);
+ while(end->next)
+ {
+ ALeffect *temp = end->next;
+ end->next = temp->next;
+
+ ALTHUNK_REMOVEENTRY(temp->effect);
+ device->EffectCount--;
+ free(temp);
+ }
alSetError(Context, AL_OUT_OF_MEMORY);
break;
}