aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alAuxEffectSlot.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-09-14 14:53:35 -0700
committerChris Robinson <[email protected]>2018-09-14 14:53:35 -0700
commita6734c7a91b1e2f2ef19ba163ceb2cb14571a9dd (patch)
tree45fb3eb2638a69a2c0f72e91d54453ae5899a1da /OpenAL32/alAuxEffectSlot.c
parentdb452a19dafd30b72255529911087edfec0d43b7 (diff)
Check the effect slot list size only when there's no free entries
The list can contain (reuable) NULL entries, so the max - current_size doesn't indicate how many can be allocated.
Diffstat (limited to 'OpenAL32/alAuxEffectSlot.c')
-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);
}