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 40CB6A0C41; Thu, 30 Sep 2021 10:35:00 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BDDBA410EA; Thu, 30 Sep 2021 10:34:59 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 0E9A44067E; Thu, 30 Sep 2021 10:34:56 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10122"; a="204620276" X-IronPort-AV: E=Sophos;i="5.85,335,1624345200"; d="scan'208";a="204620276" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Sep 2021 01:34:55 -0700 X-IronPort-AV: E=Sophos;i="5.85,335,1624345200"; d="scan'208";a="520265582" Received: from unknown (HELO localhost.localdomain) ([10.240.183.93]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Sep 2021 01:34:53 -0700 From: dapengx.yu@intel.com To: Jasvinder Singh , Cristian Dumitrescu Cc: dev@dpdk.org, Dapeng Yu , stable@dpdk.org Date: Thu, 30 Sep 2021 16:34:44 +0800 Message-Id: <20210930083444.636152-1-dapengx.yu@intel.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] net/softnic: fix memory leak of meter policy 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 Sender: "dev" From: Dapeng Yu After the meter policies are created, they are not freed on device close. This patch fixes it. Fixes: 5f0d54f372f0 ("ethdev: add pre-defined meter policy API") Cc: stable@dpdk.org Signed-off-by: Dapeng Yu --- drivers/net/softnic/rte_eth_softnic_meter.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/softnic/rte_eth_softnic_meter.c b/drivers/net/softnic/rte_eth_softnic_meter.c index 5831892a39..6b02f43e31 100644 --- a/drivers/net/softnic/rte_eth_softnic_meter.c +++ b/drivers/net/softnic/rte_eth_softnic_meter.c @@ -52,6 +52,18 @@ softnic_mtr_free(struct pmd_internals *p) TAILQ_REMOVE(&p->mtr.meter_profiles, mp, node); free(mp); } + + /* Remove meter policies */ + for ( ; ; ) { + struct softnic_mtr_meter_policy *mp; + + mp = TAILQ_FIRST(&p->mtr.meter_policies); + if (mp == NULL) + break; + + TAILQ_REMOVE(&p->mtr.meter_policies, mp, node); + free(mp); + } } struct softnic_mtr_meter_profile * -- 2.27.0