net/oic: Handle coap error in dispatch_coap_request (#2141)
net/oic: Handle coap error in dispatch_coap_request (#2141)

If there was an error during cbor processing the code in
dispatch_coap_request() would set an incorrect payload length
of 0xffff since the return code of -1 was being interpreted as
a length instead of an error. The new code checks for error
from oc_rep_finalize(), and if there is an error, frees the
appropriate buffers and clears and transactions (if any).
mlaz/mynewt-core,mlaz/mynewt-core,mlaz/mynewt-core,mlaz/mynewt-core,mlaz/mynewt-core