From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id D3DF3C6E0 for ; Thu, 25 Jun 2015 20:33:00 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP; 25 Jun 2015 11:33:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,678,1427785200"; d="scan'208";a="753255824" Received: from irsmsx154.ger.corp.intel.com ([163.33.192.96]) by orsmga002.jf.intel.com with ESMTP; 25 Jun 2015 11:32:59 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.245]) by IRSMSX154.ger.corp.intel.com ([169.254.12.91]) with mapi id 14.03.0224.002; Thu, 25 Jun 2015 19:32:57 +0100 From: "Ananyev, Konstantin" To: "Iremonger, Bernard" , "dev@dpdk.org" Thread-Topic: [PATCH] librte_ether: release memory in uninit function. Thread-Index: AQHQr1ODYI6RvIWfakGyy9IaW4okIJ29ifFA Date: Thu, 25 Jun 2015 18:32:57 +0000 Message-ID: <2601191342CEEE43887BDE71AB97725836A1E193@irsmsx105.ger.corp.intel.com> References: <1435242628-8619-1-git-send-email-bernard.iremonger@intel.com> In-Reply-To: <1435242628-8619-1-git-send-email-bernard.iremonger@intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] librte_ether: release memory in uninit function. X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2015 18:33:01 -0000 Hi Bernard, > -----Original Message----- > From: Iremonger, Bernard > Sent: Thursday, June 25, 2015 3:30 PM > To: dev@dpdk.org > Cc: Zhang, Helin; Ananyev, Konstantin; Qiu, Michael; mukawa@igel.co.jp; I= remonger, Bernard > Subject: [PATCH] librte_ether: release memory in uninit function. >=20 >=20 > Signed-off-by: Bernard Iremonger > --- > lib/librte_ether/rte_ethdev.c | 8 +++++++- > 1 files changed, 7 insertions(+), 1 deletions(-) >=20 > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.= c > index e13fde5..2404556 100644 > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -369,8 +369,14 @@ rte_eth_dev_uninit(struct rte_pci_device *pci_dev) > /* free ether device */ > rte_eth_dev_release_port(eth_dev); >=20 > - if (rte_eal_process_type() =3D=3D RTE_PROC_PRIMARY) > + if (rte_eal_process_type() =3D=3D RTE_PROC_PRIMARY) { > + rte_free(eth_dev->data->rx_queues); > + rte_free(eth_dev->data->tx_queues); > rte_free(eth_dev->data->dev_private); > + rte_free(eth_dev->data->mac_addrs); > + rte_free(eth_dev->data->hash_mac_addrs); Sorry, but I don't understand why you put last 2 rte_free()s here. You already do relese mac_addrs and hash_mac_addrs memory at each PMD _unin= it routine. Plus, as Stephen said - it would be better if same component (PMD in that c= ase) would do both alloc and free. Apart from that, patch looks good to me. Konstantin=20 > + memset(eth_dev->data, 0, sizeof(struct rte_eth_dev_data)); > + } >=20 > eth_dev->pci_dev =3D NULL; > eth_dev->driver =3D NULL; > -- > 1.7.4.1