Fix a few scan-build warnings in the unit tests

None of these are actually reachable now, but it would be nice to silence them.