test/ipsec: fix tear down
authorBernard Iremonger <bernard.iremonger@intel.com>
Fri, 28 Jun 2019 13:29:21 +0000 (14:29 +0100)
committerAkhil Goyal <akhil.goyal@nxp.com>
Fri, 5 Jul 2019 13:28:14 +0000 (15:28 +0200)
Set freed cop pointers to NULL
Set other freed pointers to NULL instead of 0

Fixes: 05fe65eb66b2 ("test/ipsec: introduce functional test")
Cc: stable@dpdk.org
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
app/test/test_ipsec.c

index 0667dd0..df87884 100644 (file)
@@ -452,8 +452,10 @@ ut_teardown(void)
 
        for (i = 0; i < BURST_SIZE; i++) {
                /* free crypto operation structure */
-               if (ut_params->cop[i])
+               if (ut_params->cop[i]) {
                        rte_crypto_op_free(ut_params->cop[i]);
+                       ut_params->cop[i] = NULL;
+               }
 
                /*
                 * free mbuf - both obuf and ibuf are usually the same,
@@ -463,17 +465,17 @@ ut_teardown(void)
                if (ut_params->obuf[i]) {
                        rte_pktmbuf_free(ut_params->obuf[i]);
                        if (ut_params->ibuf[i] == ut_params->obuf[i])
-                               ut_params->ibuf[i] = 0;
-                       ut_params->obuf[i] = 0;
+                               ut_params->ibuf[i] = NULL;
+                       ut_params->obuf[i] = NULL;
                }
                if (ut_params->ibuf[i]) {
                        rte_pktmbuf_free(ut_params->ibuf[i]);
-                       ut_params->ibuf[i] = 0;
+                       ut_params->ibuf[i] = NULL;
                }
 
                if (ut_params->testbuf[i]) {
                        rte_pktmbuf_free(ut_params->testbuf[i]);
-                       ut_params->testbuf[i] = 0;
+                       ut_params->testbuf[i] = NULL;
                }
        }