Fixed coverity issues in protocols.

Fixes CID 73099, CID 66411.