From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 09FD45951 for ; Thu, 1 May 2014 17:03:11 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 01 May 2014 08:02:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.97,965,1389772800"; d="scan'208";a="531932081" Received: from irsmsx103.ger.corp.intel.com ([163.33.3.157]) by fmsmga002.fm.intel.com with ESMTP; 01 May 2014 08:00:57 -0700 Received: from irsmsx107.ger.corp.intel.com (163.33.3.99) by IRSMSX103.ger.corp.intel.com (163.33.3.157) with Microsoft SMTP Server (TLS) id 14.3.123.3; Thu, 1 May 2014 16:00:22 +0100 Received: from irsmsx101.ger.corp.intel.com ([169.254.1.249]) by IRSMSX107.ger.corp.intel.com ([169.254.10.172]) with mapi id 14.03.0123.003; Thu, 1 May 2014 16:00:22 +0100 From: "Burakov, Anatoly" To: David Marchand , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH 1/7] pci: fix potential mem leak Thread-Index: AQHPYuSe9ue4jnEWcUqhLjkC7fOjG5sr1asQ Date: Thu, 1 May 2014 15:00:21 +0000 Message-ID: References: <1398691187-4918-1-git-send-email-david.marchand@6wind.com> <1398691187-4918-2-git-send-email-david.marchand@6wind.com> In-Reply-To: <1398691187-4918-2-git-send-email-david.marchand@6wind.com> Accept-Language: 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 1/7] pci: fix potential mem leak 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, 01 May 2014 15:03:12 -0000 Hi David, > Looking at bsd implementation, we can see that there is a potential mem > leak in linux implementation. Fix this. >=20 > Signed-off-by: David Marchand > --- > lib/librte_eal/linuxapp/eal/eal_pci.c | 1 + > 1 file changed, 1 insertion(+) >=20 > diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c > b/lib/librte_eal/linuxapp/eal/eal_pci.c > index 9538efe..313bab7 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_pci.c > +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c > @@ -678,6 +678,7 @@ pci_uio_map_resource(struct rte_pci_device *dev) > (mapaddr =3D pci_map_resource(dev, > NULL, devname, (off_t)offset, > (size_t)maps[j].size)) =3D=3D NULL) { > + rte_free(uio_res); > return (-1); > } >=20 > -- > 1.7.10.4 Actually, there's another possible mem leak, right after uio_res =3D rte_zm= alloc(): /* collect info about device mappings */ if ((nb_maps =3D pci_uio_get_mappings(dirname, uio_res->maps, sizeof (uio_res->maps) / sizeof (uio_res->maps[0]))) < 0) return (nb_maps); Best regards, Anatoly Burakov DPDK SW Engineer -------------------------------------------------------------- Intel Shannon Limited Registered in Ireland Registered Office: Collinstown Industrial Park, Leixlip, County Kildare Registered Number: 308263 Business address: Dromore House, East Park, Shannon, Co. Clare =20