Resolve Coverity reported issues of uninitialized variables and
unrecovered stream states.