aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alSource.c
diff options
context:
space:
mode:
Diffstat (limited to 'OpenAL32/alSource.c')
-rw-r--r--OpenAL32/alSource.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/OpenAL32/alSource.c b/OpenAL32/alSource.c
index a0e40c1d..22774fa4 100644
--- a/OpenAL32/alSource.c
+++ b/OpenAL32/alSource.c
@@ -2268,14 +2268,16 @@ AL_API ALvoid AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources)
newcount = context->MaxVoices << 1;
if(newcount > 0)
- temp = realloc(context->Voices, newcount * sizeof(context->Voices[0]));
+ temp = al_malloc(16, newcount * sizeof(context->Voices[0]));
if(!temp)
{
UnlockContext(context);
SET_ERROR_AND_GOTO(context, AL_OUT_OF_MEMORY, done);
}
+ memcpy(temp, context->Voices, context->MaxVoices * sizeof(temp[0]));
memset(&temp[context->MaxVoices], 0, (newcount-context->MaxVoices) * sizeof(temp[0]));
+ al_free(context->Voices);
context->Voices = temp;
context->MaxVoices = newcount;
}