diff --git a/src/net.c b/src/net.c index 106dbd6aa4..b8aefa7737 100644 --- a/src/net.c +++ b/src/net.c @@ -2080,6 +2080,10 @@ handle_request(coap_context_t *context, coap_session_t *session, coap_pdu_t *pdu } response = NULL; } else { + if (response) { + coap_delete_pdu(response); + response = NULL; + } coap_log(LOG_WARNING, "cannot generate response\r\n"); } } else {