in the first place since realloc(NULL, size) is equivalent to malloc(size). Write code straightforward while i'm here.