fix mem leak in decode message, free the packet and msg