Fix coverity detected defects