Cleanup issues reported by scan-build