Fixes some minor issues found by scan build
6 files changed