Fix two test-only leaks found by LSan.

The result of getBufferForFile() must be freed.
(Should we change functions that expect the caller to assume ownership so
that they return unique_ptrs instead? Then the type system makes sure we get
this right.)