CDM: Coverity fixes for utility functions.