Added stdlib.h to include malloc and free functions