Implementation of malloc in C