From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 229AE5AA4 for ; Sat, 25 Jun 2016 18:04:41 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP; 25 Jun 2016 09:04:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,527,1459839600"; d="scan'208";a="1005091269" Received: from sie-lab-212-116.ir.intel.com (HELO silpixa00378492.ir.intel.com) ([10.237.212.116]) by orsmga002.jf.intel.com with ESMTP; 25 Jun 2016 09:04:40 -0700 From: Pablo de Lara To: dev@dpdk.org Cc: Pablo de Lara Date: Sat, 25 Jun 2016 17:11:21 +0100 Message-Id: <1466871081-22815-1-git-send-email-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.5.0 Subject: [dpdk-dev] [PATCH] app/test: avoid freeing mbuf twice X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Jun 2016 16:04:42 -0000 In cryptodev tests, when input and output buffers were the same, the mbuf was being freed twice, causing refcnt_atomic to be negative. Fixes: 202d375c60bc ("app/test: add cryptodev unit and performance tests") Signed-off-by: Pablo de Lara --- app/test/test_cryptodev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 1a67ffb..67608ff 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -396,10 +396,13 @@ ut_teardown(void) /* * free mbuf - both obuf and ibuf are usually the same, - * but rte copes even if we call free twice + * so check if they point at the same address is necessary, + * to avoid freeing the mbuf twice. */ if (ut_params->obuf) { rte_pktmbuf_free(ut_params->obuf); + if (ut_params->ibuf == ut_params->obuf) + ut_params->ibuf = 0; ut_params->obuf = 0; } if (ut_params->ibuf) { -- 2.5.0