Fixes error checks for benchmarks.
Fixes memory leaks/errors.