From f520257463635f1fb93d4885673714bde146cf36 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 20 Jan 2012 16:23:15 -0800 Subject: Avoid duplicating some initialization code --- OpenAL32/alEffect.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'OpenAL32/alEffect.c') diff --git a/OpenAL32/alEffect.c b/OpenAL32/alEffect.c index 3446fbd7..ff7195aa 100644 --- a/OpenAL32/alEffect.c +++ b/OpenAL32/alEffect.c @@ -55,13 +55,13 @@ AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects) for(i = 0;i < n;i++) { ALeffect *effect = calloc(1, sizeof(ALeffect)); - if(!effect) + if(!effect || InitEffect(effect) != AL_NO_ERROR) { + free(effect); alSetError(Context, AL_OUT_OF_MEMORY); alDeleteEffects(i, effects); break; } - InitEffectParams(effect, AL_EFFECT_NULL); err = NewThunkEntry(&effect->effect); if(err == AL_NO_ERROR) @@ -1173,6 +1173,12 @@ static void null_GetParamfv(ALeffect *effect, ALCcontext *context, ALenum param, { (void)effect;(void)param;(void)vals; alSetError(context, AL_INVALID_ENUM); } +ALenum InitEffect(ALeffect *effect) +{ + InitEffectParams(effect, AL_EFFECT_NULL); + return AL_NO_ERROR; +} + ALvoid ReleaseALEffects(ALCdevice *device) { ALsizei i; -- cgit v1.2.3