DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/compress-perf: fix memory deallocation issue
@ 2019-08-06  9:40 Adam Dybkowski
  2019-09-09 14:05 ` Trybula, ArturX
  2019-09-19 14:51 ` Akhil Goyal
  0 siblings, 2 replies; 3+ messages in thread
From: Adam Dybkowski @ 2019-08-06  9:40 UTC (permalink / raw)
  To: dev, fiona.trahe, pablo.de.lara.guarch; +Cc: Adam Dybkowski

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(-)

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);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-19 14:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-06  9:40 [dpdk-dev] [PATCH] app/compress-perf: fix memory deallocation issue Adam Dybkowski
2019-09-09 14:05 ` Trybula, ArturX
2019-09-19 14:51 ` Akhil Goyal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).