fixed defects found by coverity scan

It's not my code, I only eliminated the warnings