Valgrind fixes for ptable-resample and res-scat additions

This PR fixes valgrind errors from the ptable-resample and res-scat PRs. Note that this PR fails 2 tests for the build configuration mpi-omp.

@walshjon - if you can take a look and see if you can spot the issue.