From bec2f7df9c4509e42c266b164af3ac5998447ffb Mon Sep 17 00:00:00 2001 From: Shaopeng He Date: Fri, 5 Feb 2016 12:57:50 +0800 Subject: [PATCH] examples/l3fwd-power: fix memory leak for non-IP packets Previous l3fwd-power only processes IP and IPv6 packets, other packets' mbufs are not freed, and this causes a memory leak. This patch fixes this issue. Fixes: 3c0184cc0c60 ("examples: replace some offload flags with packet type") Signed-off-by: Shaopeng He Acked-by: Jing Chen Acked-by: Michael Qiu --- doc/guides/rel_notes/release_16_04.rst | 6 ++++++ examples/l3fwd-power/main.c | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst index 8d6e593cff..67892a8d45 100644 --- a/doc/guides/rel_notes/release_16_04.rst +++ b/doc/guides/rel_notes/release_16_04.rst @@ -276,6 +276,12 @@ Libraries Examples ~~~~~~~~ +* **l3fwd-power: Fixed memory leak for non-IP packet.** + + Fixed issue in l3fwd-power where, on receiving packets of types + other than IPv4 or IPv6, the mbuf was not released, and caused + a memory leak. + * **examples/vhost: Fixed frequent mbuf allocation failure.** vhost-switch often fails to allocate mbuf when dequeue from vring because it diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index d4bb7a3638..e7ebe30f2f 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -682,7 +682,8 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint8_t portid, /* We don't currently handle IPv6 packets in LPM mode. */ rte_pktmbuf_free(m); #endif - } + } else + rte_pktmbuf_free(m); } -- 2.20.1