From 4906a040226a37d1fc4897b46fef5766db14f3bf Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Thu, 21 Sep 2017 22:13:21 +0200 Subject: [PATCH] remove memory leak - free packet buffer if the packet is dropped --- drivers/net/uhyve-net.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/uhyve-net.c b/drivers/net/uhyve-net.c index 190161b84..4e7428d0a 100755 --- a/drivers/net/uhyve-net.c +++ b/drivers/net/uhyve-net.c @@ -215,11 +215,13 @@ static void uhyve_netif_poll(void) #endif - //forward packet to LwIP - if (tcpip_callback_with_block(consume_packet, p, 0) == ERR_OK) + //forward packet to the IP thread + if (tcpip_callback_with_block(consume_packet, p, 0) == ERR_OK) { LINK_STATS_INC(link.recv); - else + } else { LINK_STATS_INC(link.drop); + pbuf_free(p); + } } else { LOG_ERROR("uhyve_netif_poll: not enough memory!\n"); LINK_STATS_INC(link.memerr);