Simple heap memory management in C