Fix more memory leaks in the buffer tests