explicitly included stdlib.h for malloc and free