Fix ref_vec reallocation.

This commit is contained in:
Danila Fedorin 2018-06-12 02:27:53 -07:00
parent dc9702df4c
commit b5b4d7816a

View File

@ -33,8 +33,9 @@ libab_result _libab_ref_vec_try_resize(libab_ref_vec* vec) {
if (vec->size == vec->capacity) {
libab_ref* new_memory =
realloc(vec->data, (vec->capacity *= 2) * sizeof(*vec->data));
if (new_memory == NULL) {
free(vec->data);
if(new_memory) {
vec->data = new_memory;
} else {
result = LIBAB_MALLOC;
}
}