From 2e7ec3979aec71f11c45b737b77d58978cbee7e2 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 21 May 2016 03:27:51 -0700 Subject: Avoid using realloc in a number of places --- Alc/helpers.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Alc/helpers.c') diff --git a/Alc/helpers.c b/Alc/helpers.c index 950a67bf..38a34939 100644 --- a/Alc/helpers.c +++ b/Alc/helpers.c @@ -759,9 +759,12 @@ ALboolean vector_reserve(char *ptr, size_t base_size, size_t obj_size, size_t ob /* Need to be explicit with the caller type's base size, because it * could have extra padding before the start of the array (that is, * sizeof(*vector_) may not equal base_size). */ - temp = realloc(*vecptr, base_size + obj_size*obj_count); + temp = al_calloc(16, base_size + obj_size*obj_count); if(temp == NULL) return AL_FALSE; + memcpy(((ALubyte*)temp)+base_size, ((ALubyte*)*vecptr)+base_size, + obj_size*old_size); + al_free(*vecptr); *vecptr = temp; (*vecptr)->Capacity = obj_count; (*vecptr)->Size = old_size; -- cgit v1.2.3