From f0cb66e3de4037beea44ead0a89ccee9686a1e6a Mon Sep 17 00:00:00 2001 From: Pablo de Lara Date: Mon, 27 Jun 2016 13:41:27 +0100 Subject: [PATCH] app/test: avoid freeing mbufs twice in qat test Test_multi_session was freeing mbufs used in the multiple sessions created and setting obuf to NULL after it, but ibuf was not being set to NULL, and therefore, it was being freed again (ibuf and obuf are pointing at the same address), in the ut_teardown() function. Fixes: 1b9cb73ecef1 ("app/test: fix qat autotest failure") Signed-off-by: Pablo de Lara Acked-by: Deepak Kumar Jain --- app/test/test_cryptodev.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 67608ff5ca..9dfe34f8c1 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -3471,12 +3471,19 @@ test_multi_session(void) /* * free mbuf - both obuf and ibuf are usually the same, - * but rte copes even if we call free twice + * so check if they point at the same address is necessary, + * to avoid freeing the mbuf twice. */ if (ut_params->obuf) { rte_pktmbuf_free(ut_params->obuf); + if (ut_params->ibuf == ut_params->obuf) + ut_params->ibuf = 0; ut_params->obuf = 0; } + if (ut_params->ibuf) { + rte_pktmbuf_free(ut_params->ibuf); + ut_params->ibuf = 0; + } } /* Next session create should fail */ -- 2.20.1