[Core] Fixed up some causes of static analysis warnings (reported by
CppCheck)