fixed how malloc allocates memory for packet structs