Coverity scan fixes

Correct some defects highlighted by Coverity Scan. These changes won't have an impact in OC's performance.

Corrected defects:
* CID 967154
* CID 967156
* CID 1257669
* CID 1257672
See error_code is set above. Should we remove this or the above one? Btw, bad spacing.