All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adam Dybkowski <adamx.dybkowski@intel.com>
To: dev@dpdk.org, fiona.trahe@intel.com, pablo.de.lara.guarch@intel.com
Cc: Adam Dybkowski <adamx.dybkowski@intel.com>
Subject: [dpdk-dev] [PATCH] app/compress-perf: fix memory deallocation issue
Date: Tue,  6 Aug 2019 11:40:53 +0200	[thread overview]
Message-ID: <20190806094053.16009-1-adamx.dybkowski@intel.com> (raw)

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


             reply	other threads:[~2019-08-06  9:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-06  9:40 Adam Dybkowski [this message]
2019-09-09 14:05 ` [dpdk-dev] [PATCH] app/compress-perf: fix memory deallocation issue Trybula, ArturX
2019-09-19 14:51 ` Akhil Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190806094053.16009-1-adamx.dybkowski@intel.com \
    --to=adamx.dybkowski@intel.com \
    --cc=dev@dpdk.org \
    --cc=fiona.trahe@intel.com \
    --cc=pablo.de.lara.guarch@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.