Coverity scan reported several issues with the existing code base. To avoid potential problems - reduce the defect count in code.