[coverity] Fixes for issues found by scan.coverity.com