From 29692faa863d8ce345e0440434ecfa6d71e7ec77 Mon Sep 17 00:00:00 2001 From: Olaf Bergmann Date: Fri, 3 Nov 2017 14:12:22 +0100 Subject: [PATCH] coap-server.c: fix use after free in check_async() As coap_send() automatically releases the specified pdu, it must not be accessed after coap_send() has returned. This change fixes CID 1458399 reported by Coverity scan. --- examples/coap-server.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/coap-server.c b/examples/coap-server.c index 32a207a7..ebbb9ca6 100644 --- a/examples/coap-server.c +++ b/examples/coap-server.c @@ -266,8 +266,7 @@ check_async(coap_context_t *ctx, coap_add_data(response, 4, (unsigned char *)"done"); if (coap_send(async->session, response) == COAP_INVALID_TID) { - debug("check_async: cannot send response for message %d\n", - response->tid); + debug("check_async: cannot send response for message\n"); } coap_remove_async(ctx, async->session, async->id, &tmp); coap_free_async(async);