Fixes to issues identified by Coverity.