SERVER-9808 Fix issues found in static code analysis