aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/alSource.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-05-21 03:27:51 -0700
committerChris Robinson <[email protected]>2016-05-21 03:27:51 -0700
commit2e7ec3979aec71f11c45b737b77d58978cbee7e2 (patch)
treec931d2f9b55cc6803a00896f92793a58de8fdc11 /OpenAL32/alSource.c
parent7bf64eaee0788b7eb64c7410384a9ee66f75c4ce (diff)
Avoid using realloc in a number of places
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;
}