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: af75078fec ("first public release")
Cc: stable@dpdk.org

Reported-by: Keith Wiles <keith.wiles@intel.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
This commit is contained in:
Olivier Matz 2018-01-29 10:39:23 +01:00 committed by Thomas Monjalon
parent 096ffd811f
commit 9f8d9b2ee3

View File

@ -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;