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 E3FDAA00BE; Mon, 14 Mar 2022 06:41:22 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 84CE140DF4; Mon, 14 Mar 2022 06:41:22 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 3A57D40DDD for ; Mon, 14 Mar 2022 06:41:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1647236481; x=1678772481; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=JN15BnLWIQurIDA0ZHau3fwTeU0jE0d0qg92n5MzSMA=; b=RowUykbzxv5FhwTnS9kv3JYVmh8fNHnUzciYl0GFy9Erg61mB7RcztO1 CIBQWk/qWetIK4zxbUVFCDTjhn19Ze2cJUTMcXDbZoVlbHG3+BeWDIjvv wVAmWSnsu1YeLIe2cXC54yBRq52wtbOyos5Tc/EKrXoF5sbQsSj/D7W9r OBn7dHunl9zDj3AEPMmmtKCRGCcTy5rANVf1ZMjlu2EBy58B4r9lq74FF NYlscc4VM6a8u8/3U0ujxeIAOdN/8eikjlcgBvOhKc2i6ZlLnrGzPj3W/ SXiDy06O7JW4nKsrxWkE0N52bVaMd4wicIiLwefSK7NGZWQSJQti0Zw2q A==; X-IronPort-AV: E=McAfee;i="6200,9189,10285"; a="255892199" X-IronPort-AV: E=Sophos;i="5.90,179,1643702400"; d="scan'208";a="255892199" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2022 22:41:20 -0700 X-IronPort-AV: E=Sophos;i="5.90,179,1643702400"; d="scan'208";a="556243807" Received: from intel-corei7-64.sh.intel.com (HELO localhost.localdomain) ([10.239.251.104]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Mar 2022 22:41:18 -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:34:59 +0000 Message-Id: <20220314053459.390288-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