How do I make a dynamic 2d array in C with malloc realloc and free?