From 29d79607fc285618f8441c8810632aa79ceade15 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Sun, 19 Apr 2020 16:22:40 +0200 Subject: [PATCH] Avoid calling malloc() in fast_retransmit(). --- utcp.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) 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) { -- 2.39.5