From: Adam Dybkowski Date: Tue, 6 Aug 2019 09:40:53 +0000 (+0200) Subject: app/compress-perf: fix memory deallocation X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=c591df32ad8e9beb59c5970a893c20b7574c4c87;p=dpdk.git app/compress-perf: fix memory deallocation 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") Cc: stable@dpdk.org Signed-off-by: Adam Dybkowski Acked-by: Artur Trybula --- diff --git a/app/test-compress-perf/comp_perf_test_common.c b/app/test-compress-perf/comp_perf_test_common.c index 6edc40f044..7b26734c9b 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);