Fix more memory leaks in buffer tests