From: Guus Sliepen Date: Sun, 19 Apr 2020 14:22:40 +0000 (+0200) Subject: Avoid calling malloc() in fast_retransmit(). X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=29d79607fc285618f8441c8810632aa79ceade15;p=utcp Avoid calling malloc() in fast_retransmit(). --- diff --git a/utcp.c b/utcp.c index f7c1859..19f6cfa 100644 --- a/utcp.c +++ b/utcp.c @@ -847,13 +847,7 @@ static void fast_retransmit(struct utcp_connection *c) { struct { struct hdr hdr; uint8_t data[]; - } *pkt; - - pkt = malloc(c->utcp->mtu); - - if(!pkt) { - return; - } + } *pkt = c->utcp->pkt; pkt->hdr.src = c->src; pkt->hdr.dst = c->dst; @@ -885,8 +879,6 @@ static void fast_retransmit(struct utcp_connection *c) { default: break; } - - free(pkt); } static void retransmit(struct utcp_connection *c) {