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 9AB0FA00BE; Mon, 14 Mar 2022 06:59:19 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2ED5540DF4; Mon, 14 Mar 2022 06:59:19 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 9C9CD40DDD for ; Mon, 14 Mar 2022 06:59:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1647237557; x=1678773557; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JN15BnLWIQurIDA0ZHau3fwTeU0jE0d0qg92n5MzSMA=; b=WUlEbSqy7Tr12N+kvX2hTOTeOwNFBqsV7jdqJ/KLnagjQwLKEISVusR+ porTVdir90pVqCxfi+9hKJ1hp/UX09WQAa0seVDnwbyD5VIolHB/Ly9ri MJJ2w/+oZpgPknN1maqKCS1vX0x+HcIsB3oMKo+xoIKHSRkjSOJRza1WG PoRFVwiysoet8cWNOtW7fPcVi4jhASCmBnVF5/Xea1prVADXdY1YGJXG+ rbzJmO4B+WCva3xnwxHjE9nadDT/AYBxrZ94ZFG9RVYHCxGqDB4QN9TYQ UAMML3pXVGi57JOSFMMpZj7YZiKBSApYJ/tPpq2yfT8f6VR/rxOGnJAma Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10285"; a="255670691" X-IronPort-AV: E=Sophos;i="5.90,179,1643702400"; d="scan'208";a="255670691" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2022 22:59:16 -0700 X-IronPort-AV: E=Sophos;i="5.90,179,1643702400"; d="scan'208";a="539818666" Received: from intel-corei7-64.sh.intel.com (HELO localhost.localdomain) ([10.239.251.104]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2022 22:59:14 -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:52:52 +0000 Message-Id: <20220314055252.392004-1-ke1x.zhang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220301020653.329263-1-ke1x.zhang@intel.com> References: <20220301020653.329263-1-ke1x.zhang@intel.com> 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