diff options
Diffstat (limited to 'data_structures.c')
-rw-r--r-- | data_structures.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/data_structures.c b/data_structures.c index bc7b48b..e8d0e99 100644 --- a/data_structures.c +++ b/data_structures.c @@ -100,9 +100,9 @@ static WarnUnusedResult void *arr_growa(void *arr, size_t item_sz, Allocator *al hdr = arr_hdr(arr); if (hdr->len >= hdr->cap) { size_t old_size = sizeof *hdr + item_sz * hdr->cap; - size_t new_size = sizeof *hdr + item_sz * hdr->cap * 2; - hdr = allocr_realloc(allocr, hdr, old_size, new_size); hdr->cap *= 2; + size_t new_size = sizeof *hdr + item_sz * hdr->cap; + hdr = allocr_realloc(allocr, hdr, old_size, new_size); } } return hdr->data; |