Fix two memory leaks in `trial` test runs.