From b60d33ef3abadf87df360cdf2e400566675e310a Mon Sep 17 00:00:00 2001 From: Jon Shallow Date: Fri, 12 Dec 2025 17:01:56 +0000 Subject: [PATCH] coap_pdu.c: Save unnecessary realloc() for larger packets --- src/coap_pdu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coap_pdu.c b/src/coap_pdu.c index a72d6353..cb11f9ba 100644 --- a/src/coap_pdu.c +++ b/src/coap_pdu.c @@ -143,7 +143,7 @@ coap_pdu_init(coap_pdu_type_t type, coap_pdu_code_t code, coap_mid_t mid, pdu->token = (uint8_t *)pdu->pbuf->payload + pdu->max_hdr_size; #else /* WITH_LWIP */ uint8_t *buf; - pdu->alloc_size = min(size, 256); + pdu->alloc_size = min(size, COAP_DEFAULT_MTU); buf = coap_malloc_type(COAP_PDU_BUF, pdu->alloc_size + pdu->max_hdr_size); if (buf == NULL) { coap_free_type(COAP_PDU, pdu);