From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 59705A00BE; Mon, 14 Mar 2022 06:23:27 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DD7B640DF4; Mon, 14 Mar 2022 06:23:26 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id B186340DDD for ; Mon, 14 Mar 2022 06:23:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1647235405; x=1678771405; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=JN15BnLWIQurIDA0ZHau3fwTeU0jE0d0qg92n5MzSMA=; b=TcAnXubiHItj7uCP2yvdlVb6ryIZFng83Bj4dE/pOq9VIbrdKmFfEQLv sH6XuM1lYLpEQzD+jnucZ7Ck6Qmb+N3DFLlHqDvcz1e67zqQmu+a3s8Z7 1+/g+74Vc4XuzU90PAhcEyBDjcmaC7eW55SjsjVBFdbzegiMYgv2jT3h2 ZZaoBtnKSwItnIdvqL0U8gQA1meeBJDJVieboFRRhhjiAVyc8TT5xYbfO oerh3uEXA4Tf6wQh0F7iZqk8C6BNPr67batTbFpwziBiR2hFhS1TCwKDc s55cr5ZXcbNYMQ56gXiAaEeu0lo9srUZqXZfDK3rY4o1eX85nRnfjIknR Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10285"; a="235885579" X-IronPort-AV: E=Sophos;i="5.90,179,1643702400"; d="scan'208";a="235885579" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2022 22:23:24 -0700 X-IronPort-AV: E=Sophos;i="5.90,179,1643702400"; d="scan'208";a="515274712" Received: from intel-corei7-64.sh.intel.com (HELO localhost.localdomain) ([10.239.251.104]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2022 22:23:22 -0700 From: Ke Zhang To: xiaoyun.li@intel.com, aman.deep.singh@intel.com, yuying.zhang@intel.com, dev@dpdk.org Cc: Ke Zhang Subject: [PATCH v2] app/testpmd: fix issue with memory leaks when quit testpmd Date: Mon, 14 Mar 2022 05:17:05 +0000 Message-Id: <20220314051705.390014-1-ke1x.zhang@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org when dpdk is compiled in ASan, there is a memory leaks after quit testpmd if set mcast_addr, this patch fix this issue. Error info as following: ERROR: LeakSanitizer: detected memory leaksDirect leak of 192 byte(s) 0 0x7f6a2e0aeffe in __interceptor_realloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dffe) 1 0x565361eb340f in mcast_addr_pool_extend ../app/test-pmd/config.c:5162 2 0x565361eb3556 in mcast_addr_pool_append ../app/test-pmd/config.c:5180 3 0x565361eb3aae in mcast_addr_add ../app/test-pmd/config.c:5243 Signed-off-by: Ke Zhang --- app/test-pmd/testpmd.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index fe2ce19f99..f7e18aee25 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -3136,6 +3136,12 @@ close_port(portid_t pid) continue; } + if (port->mc_addr_nb != 0) { + /* free the pool of multicast addresses. */ + free(port->mc_addr_pool); + port->mc_addr_pool = NULL; + } + if (is_proc_primary()) { port_flow_flush(pi); port_flex_item_flush(pi); -- 2.25.1