From: Olivier Matz Date: Mon, 29 Jan 2018 09:39:23 +0000 (+0100) Subject: mbuf: fix NULL freeing when debug enabled X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=9f8d9b2ee358c496fe206d1e6f111067afd501b3;p=dpdk.git mbuf: fix NULL freeing when debug enabled Do not panic when calling rte_pktmbuf_free(NULL) with mbuf debug enabled, it is a valid operation. Fixes: af75078fece3 ("first public release") Cc: stable@dpdk.org Reported-by: Keith Wiles Signed-off-by: Olivier Matz --- diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 2fd4f5ef97..ba3bfa8c6c 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -1432,13 +1432,14 @@ rte_pktmbuf_free_seg(struct rte_mbuf *m) * segment is added back into its original mempool. * * @param m - * The packet mbuf to be freed. + * The packet mbuf to be freed. If NULL, the function does nothing. */ static inline void rte_pktmbuf_free(struct rte_mbuf *m) { struct rte_mbuf *m_next; - __rte_mbuf_sanity_check(m, 1); + if (m != NULL) + __rte_mbuf_sanity_check(m, 1); while (m != NULL) { m_next = m->next;