Fix ref_vec reallocation.
This commit is contained in:
parent
dc9702df4c
commit
b5b4d7816a
|
@ -33,8 +33,9 @@ libab_result _libab_ref_vec_try_resize(libab_ref_vec* vec) {
|
||||||
if (vec->size == vec->capacity) {
|
if (vec->size == vec->capacity) {
|
||||||
libab_ref* new_memory =
|
libab_ref* new_memory =
|
||||||
realloc(vec->data, (vec->capacity *= 2) * sizeof(*vec->data));
|
realloc(vec->data, (vec->capacity *= 2) * sizeof(*vec->data));
|
||||||
if (new_memory == NULL) {
|
if(new_memory) {
|
||||||
free(vec->data);
|
vec->data = new_memory;
|
||||||
|
} else {
|
||||||
result = LIBAB_MALLOC;
|
result = LIBAB_MALLOC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user