Try to not use realloc to implement normalize_capacity.
...Because realloc may free memory pointed by data.
realloc
data