aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alSource.c
diff options
context:
space:
mode:
Diffstat (limited to 'OpenAL32/alSource.c')
-rw-r--r--OpenAL32/alSource.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index 5dbea314..f98b31ea 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -1230,7 +1230,10 @@ AL_API ALvoid AL_APIENTRY alGenSources(ALsizei n, ALuint *sources)
{
ALsource *source = al_calloc(16, sizeof(ALsource));
if(!source)
+ {
+ alDeleteSources(cur, sources);
al_throwerr(Context, AL_OUT_OF_MEMORY);
+ }
InitSourceParams(source);
err = NewThunkEntry(&source->id);
@@ -1242,17 +1245,13 @@ AL_API ALvoid AL_APIENTRY alGenSources(ALsizei n, ALuint *sources)
memset(source, 0, sizeof(ALsource));
al_free(source);
+ alDeleteSources(cur, sources);
al_throwerr(Context, err);
}
sources[cur] = source->id;
}
}
- al_catchany()
- {
- if(cur > 0)
- alDeleteSources(cur, sources);
- }
al_endtry;
ALCcontext_DecRef(Context);
@@ -2169,24 +2168,23 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint source, ALsizei nb, const
BufferListStart->prev = BufferList;
BufferList->next = BufferListStart;
}
+ BufferListStart = NULL;
Source->BuffersInQueue += nb;
UnlockContext(Context);
}
- al_catchany()
+ al_endtry;
+
+ while(BufferListStart)
{
- while(BufferListStart)
- {
- BufferList = BufferListStart;
- BufferListStart = BufferList->next;
+ BufferList = BufferListStart;
+ BufferListStart = BufferList->next;
- if(BufferList->buffer)
- DecrementRef(&BufferList->buffer->ref);
- free(BufferList);
- }
+ if(BufferList->buffer)
+ DecrementRef(&BufferList->buffer->ref);
+ free(BufferList);
}
- al_endtry;
ALCcontext_DecRef(Context);
}