Fix a few issues detected by CppCheck.