Added include for malloc.h in protocol.c