Fixing FORWARD_NULL defects reported by Coverity