Fixes for issues identified by Coverity.