app/compress-perf: fix memory deallocation issue
diff mbox series

Message ID 20190806094053.16009-1-adamx.dybkowski@intel.com
State Accepted, archived
Delegated to: akhil goyal
Headers show
Series
  • app/compress-perf: fix memory deallocation issue
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-Compile-Testing success Compile Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS
ci/Intel-compilation fail Compilation issues
ci/mellanox-Performance-Testing success Performance Testing PASS

Commit Message

Dybkowski, AdamX Aug. 6, 2019, 9:40 a.m. UTC
This patch fixes the memory deallocation issue which happened
after unsuccessful allocation (e.g. due to the out of memory)
and produced the segmentation fault.

Fixes: 424dd6c8c1 ("app/compress-perf: add weak functions for multicore test")

Signed-off-by: Adam Dybkowski <adamx.dybkowski@intel.com>
---
 app/test-compress-perf/comp_perf_test_common.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

Artur Trybula Sept. 9, 2019, 2:05 p.m. UTC | #1
This patch fixes the memory deallocation issue which happened after unsuccessful allocation (e.g. due to the out of memory) and produced the segmentation fault.

Fixes: 424dd6c8c1 ("app/compress-perf: add weak functions for multicore test")

Signed-off-by: Adam Dybkowski <adamx.dybkowski@intel.com>
Acked-by: Artur Trybula <arturx.trybula@intel.com>
---
Akhil Goyal Sept. 19, 2019, 2:51 p.m. UTC | #2
> 
> This patch fixes the memory deallocation issue which happened
> after unsuccessful allocation (e.g. due to the out of memory)
> and produced the segmentation fault.
> 
> Fixes: 424dd6c8c1 ("app/compress-perf: add weak functions for multicore
> test")
> 
> Signed-off-by: Adam Dybkowski <adamx.dybkowski@intel.com>
> ---
Applied to dpdk-next-crypto

Thanks.

Patch
diff mbox series

diff --git a/app/test-compress-perf/comp_perf_test_common.c b/app/test-compress-perf/comp_perf_test_common.c
index 6edc40f04..7b26734c9 100644
--- a/app/test-compress-perf/comp_perf_test_common.c
+++ b/app/test-compress-perf/comp_perf_test_common.c
@@ -81,10 +81,13 @@  comp_perf_free_memory(struct cperf_mem_resources *mem)
 {
 	uint32_t i;
 
-	for (i = 0; i < mem->total_bufs; i++) {
-		rte_pktmbuf_free(mem->comp_bufs[i]);
-		rte_pktmbuf_free(mem->decomp_bufs[i]);
-	}
+	if (mem->decomp_bufs != NULL)
+		for (i = 0; i < mem->total_bufs; i++)
+			rte_pktmbuf_free(mem->decomp_bufs[i]);
+
+	if (mem->comp_bufs != NULL)
+		for (i = 0; i < mem->total_bufs; i++)
+			rte_pktmbuf_free(mem->comp_bufs[i]);
 
 	rte_free(mem->decomp_bufs);
 	rte_free(mem->comp_bufs);