Replaced all instances of realloc and calloc and strdup with their z counterpart.