Partial implementation of malloc with bugs