free returns the memory that is obtained from malloc, calloc, realloc, memalign, or valloc to system memory. Trying to free a block that was not reserved by a dynamic memory allocation interface is an error that can cause a process to crash.
calloc returns a pointer to a block of memory that is initialized to zeros. Memory reserved by calloc can be returned to the system through either cfree or free. The memory is allocated and aligned to contain an array of a specified number of elements of a specified size.
realloc changes the size of the memory block allocated to a process. realloc can be used to increase or reduce the size of an allocated block of memory. realloc is the only way to shrink a memory allocation without causing a problem. The location in memory of the reallocated block might be changed, but the contents up to the point of the allocation size change remain the same.