aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-07-26 04:53:25 -0700
committerChris Robinson <[email protected]>2016-07-26 04:53:25 -0700
commitb047eda1cbd9c8c1345c610b7ac236867b908cc6 (patch)
treeff820a6e97f7e4e0df5a2d4601fd268fcefbeb66
parenta6f41e4cb085c12d7adca291624ac3c33bebd3cc (diff)
Avoid passing NULL to a parameter that must not be NULL
-rw-r--r--Alc/helpers.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Alc/helpers.c b/Alc/helpers.c
index bd345b6a..e065b022 100644
--- a/Alc/helpers.c
+++ b/Alc/helpers.c
@@ -858,8 +858,9 @@ ALboolean vector_reserve(char *ptr, size_t base_size, size_t obj_size, size_t ob
* sizeof(*vector_) may not equal base_size). */
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);
+ if(*vecptr)
+ memcpy(((ALubyte*)temp)+base_size, ((ALubyte*)*vecptr)+base_size,
+ obj_size*old_size);
al_free(*vecptr);
*vecptr = temp;