Fix potential resource leaks in buffer tests

Fixes #46
2 files changed