Fixed all problems reported by the MSVC static analyser.