simple simulation of malloc() and free() in C