Fix leak in RingBuffer