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 ECA44A00BE; Mon, 14 Mar 2022 06:53:38 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C3DD740DF4; Mon, 14 Mar 2022 06:53:38 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 6873940DDD for ; Mon, 14 Mar 2022 06:53:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1647237217; x=1678773217; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=JN15BnLWIQurIDA0ZHau3fwTeU0jE0d0qg92n5MzSMA=; b=Nq+Lzq/A1brb/bok2rvICfeWM3L8fTKdw2ziMbSsv+FuWLxLB4414M32 7LCyYOxUDMRZVMmFGpFvXc0LKu+3h+2d+vbdnxuEm03+EoW4ABPFpj154 6HbscCyiz204iyGuPc24+QIXum39hPSVNUvus86NOqXbaqbLtOPV9g9Hv DwBTtG577mvX7EdlJl7xdOiimPIOlch+b8d1OqpzNZUQg9S2S3HdpQKxk 7LwXQbWudkScoTluxd1kEVSgWu5kTq86dGyBlavhCPvNMsb9p0t/tSAp7 IyegqqhH2b+PwbRZxbXxrd1+6YGRlvrM7twdeMqs9suO1uRj3fT31k/RH g==; X-IronPort-AV: E=McAfee;i="6200,9189,10285"; a="280699111" X-IronPort-AV: E=Sophos;i="5.90,179,1643702400"; d="scan'208";a="280699111" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2022 22:53:36 -0700 X-IronPort-AV: E=Sophos;i="5.90,179,1643702400"; d="scan'208";a="689701587" Received: from intel-corei7-64.sh.intel.com (HELO localhost.localdomain) ([10.239.251.104]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2022 22:53:34 -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:47:17 +0000 Message-Id: <20220314054717.391952-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