app/test: avoid freeing mbufs twice in qat test
[dpdk.git] / app / test / test_cryptodev.c
index 67608ff..9dfe34f 100644 (file)
@@ -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 */