net.c: fix possible NULL pointer dereference

Fixes CID 1458397 detected by Coverity scan.
This commit is contained in:
Olaf Bergmann committed 2017-11-03 14:22:32 +01:00
1 parent edca08249b
commit 4b52182b8d
1 file changed
+4 -4
+4 -4
View File
@@ -2065,12 +2065,12 @@ coap_dispatch(coap_context_t *context, coap_session_t *session,
/* find transaction in sendqueue to stop retransmission */
coap_remove_from_queue(&context->sendqueue, session, pdu->tid, &sent);
if (sent)
if (sent) {
coap_cancel(context, sent);
if(sent->pdu->type==COAP_MESSAGE_CON && context->nack_handler)
context->nack_handler(context, sent->session, sent->pdu, COAP_NACK_RST, sent->id);
if(sent->pdu->type==COAP_MESSAGE_CON && context->nack_handler)
context->nack_handler(context, sent->session, sent->pdu, COAP_NACK_RST, sent->id);
}
goto cleanup;
case COAP_MESSAGE_NON: /* check for unknown critical options */