packet: use memory.malloc for allocation