Cleanups suggested by clang's static analyzer, and -Wpedantic