Fixed memory leak for Packet reader & writer

The PacketReader and PacketWriter didn't delete the allocated buffer
properly causing a memory leak.