fixed memory leak coap_send

This commit is contained in:
Patryk Jarosz authored and Jon Shallow committed 2025-11-25 10:29:36 +00:00
1 parent bdbcf29bd1
commit 9d9b941c40
1 file changed
+2
+2
View File
@@ -1747,10 +1747,12 @@ coap_send_internal(coap_session_t *session, coap_pdu_t *pdu) {
if (pdu->used_size + 1 > pdu->max_size) {
/* No space */
coap_delete_pdu(pdu);
return (coap_mid_t)COAP_DROPPED_RESPONSE;
}
if (!coap_pdu_resize(pdu, pdu->used_size + 1)) {
/* Internal error */
coap_delete_pdu(pdu);
return (coap_mid_t)COAP_DROPPED_RESPONSE;
}
data_len = pdu->used_size - (pdu->data - pdu->token);