From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 58441A00C2;
	Sat,  7 Jan 2023 16:20:00 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id ECFF942D1E;
	Sat,  7 Jan 2023 16:19:59 +0100 (CET)
Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com
 [67.231.148.174])
 by mails.dpdk.org (Postfix) with ESMTP id 5A88042D1E
 for <dev@dpdk.org>; Sat,  7 Jan 2023 16:19:58 +0100 (CET)
Received: from pps.filterd (m0045849.ppops.net [127.0.0.1])
 by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id
 307EscFu001629; Sat, 7 Jan 2023 07:19:57 -0800
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;
 h=from : to : cc :
 subject : date : message-id : in-reply-to : references : mime-version :
 content-transfer-encoding : content-type; s=pfpt0220;
 bh=Zk4AmZeExgMV32EItZNs8jEV57Rdmwk9O+zN04Hi9bI=;
 b=NNlYKGHxZ5w8lQQogPVXLhW3PoLheUrMlmxG5REQFX3TEcsj7yN13YW9/qn/5KdqtWNG
 Hgd46utmtdEhVeXwAmrQujoGC/U1EYIOyaOiHteJ997dmbv3j9/xCKg5YPPBrFUFawlF
 ZXEQUuvWSUWqqYdz3BUFcLF75Ze5bs1LcDkbF6K8Mq4htAZilkUWio5LK8YCYcJ/sjDs
 VEv0aRgAV8NhcIAeehY6mgNlWa681jjI11rsvWcSgm6YkrXGcdyeiU6Ep+/ZyZhegAsH
 WBrVi+uBDgE35+hLMeVu9M3tX2KKLrcyDVnnN/9Ol3D3ZYszx8pRj/ahCFef+4j3VZNx /Q== 
Received: from dc5-exch02.marvell.com ([199.233.59.182])
 by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3my6yw0a8q-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);
 Sat, 07 Jan 2023 07:19:57 -0800
Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com
 (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.42;
 Sat, 7 Jan 2023 07:19:55 -0800
Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com
 (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.42 via Frontend
 Transport; Sat, 7 Jan 2023 07:19:55 -0800
Received: from cavium-DT10.. (unknown [10.28.34.39])
 by maili.marvell.com (Postfix) with ESMTP id A9A225B6925;
 Sat,  7 Jan 2023 07:19:53 -0800 (PST)
From: Volodymyr Fialko <vfialko@marvell.com>
To: <dev@dpdk.org>, Reshma Pattan <reshma.pattan@intel.com>, David Hunt
 <david.hunt@intel.com>
CC: <jerinj@marvell.com>, <anoobj@marvell.com>, Volodymyr Fialko
 <vfialko@marvell.com>
Subject: [PATCH 2/2] test/reorder: fix double free of drained buffers
Date: Sat, 7 Jan 2023 16:19:39 +0100
Message-ID: <20230107151939.2540148-3-vfialko@marvell.com>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20230107151939.2540148-1-vfialko@marvell.com>
References: <20230107151939.2540148-1-vfialko@marvell.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Proofpoint-GUID: C9xwokaAF5rXGjqu7nrX3PXoCtEsKlGn
X-Proofpoint-ORIG-GUID: C9xwokaAF5rXGjqu7nrX3PXoCtEsKlGn
X-Proofpoint-Virus-Version: vendor=baseguard
 engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1
 definitions=2023-01-07_06,2023-01-06_01,2022-06-22_01
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

Set to zero array of drained buffers after free, to prevent freeing them
one more time.
Discovered with enabled `RTE_LIBRTE_MEMPOOL_DEBUG`.

Fixes: ecd867faa860 ("test/reorder: fix freeing mbuf twice")

Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
---
 app/test/test_reorder.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/app/test/test_reorder.c b/app/test/test_reorder.c
index f0714a5c18..7b5e590bac 100644
--- a/app/test/test_reorder.c
+++ b/app/test/test_reorder.c
@@ -278,6 +278,7 @@ test_reorder_drain(void)
 		goto exit;
 	}
 	rte_pktmbuf_free(robufs[0]);
+	memset(robufs, 0, sizeof(robufs));
 
 	/* Insert more packets
 	 * RB[] = {NULL, NULL, NULL, NULL}
@@ -313,6 +314,7 @@ test_reorder_drain(void)
 	for (i = 0; i < 3; i++) {
 		rte_pktmbuf_free(robufs[i]);
 	}
+	memset(robufs, 0, sizeof(robufs));
 
 	/*
 	 * RB[] = {NULL, NULL, NULL, NULL}
-- 
2.34.1