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.
This commit is contained in:
Olaf Bergmann committed 2017-11-03 14:12:22 +01:00
1 parent 67a9210dbd
commit 29692faa86
1 file changed
+1 -2
+1 -2
View File
@@ -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);