Tidy up a few minor issues found by scan-build