aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--OpenAL32/alAuxEffectSlot.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/OpenAL32/alAuxEffectSlot.c b/OpenAL32/alAuxEffectSlot.c
index 815a8d5a..b293b6a5 100644
--- a/OpenAL32/alAuxEffectSlot.c
+++ b/OpenAL32/alAuxEffectSlot.c
@@ -122,12 +122,6 @@ AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslo
LockEffectSlotList(context);
device = context->Device;
- if(device->AuxiliaryEffectSlotMax - VECTOR_SIZE(context->EffectSlotList) < (ALuint)n)
- {
- UnlockEffectSlotList(context);
- SETERR_GOTO(context, AL_OUT_OF_MEMORY, done, "Exceeding %u auxiliary effect slot limit",
- device->AuxiliaryEffectSlotMax);
- }
for(cur = 0;cur < n;cur++)
{
ALeffectslotPtr *iter = VECTOR_BEGIN(context->EffectSlotList);
@@ -142,6 +136,13 @@ AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslo
}
if(iter == end)
{
+ if(device->AuxiliaryEffectSlotMax == VECTOR_SIZE(context->EffectSlotList))
+ {
+ UnlockEffectSlotList(context);
+ alDeleteAuxiliaryEffectSlots(cur, effectslots);
+ SETERR_GOTO(context, AL_OUT_OF_MEMORY, done,
+ "Exceeding %u auxiliary effect slot limit", device->AuxiliaryEffectSlotMax);
+ }
VECTOR_PUSH_BACK(context->EffectSlotList, NULL);
iter = &VECTOR_BACK(context->EffectSlotList);
}