From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Marchand Subject: Re: [PATCH 1/7] pci: fix potential mem leak Date: Mon, 5 May 2014 10:14:22 +0200 Message-ID: References: <1398691187-4918-1-git-send-email-david.marchand@6wind.com> <1398691187-4918-2-git-send-email-david.marchand@6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Cc: "dev-VfR2kkLFssw@public.gmane.org" To: "Burakov, Anatoly" Return-path: In-Reply-To: List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" Hello Anatoly, Oh yes, missed this one. Ok, I will resubmit an updated patch. Thanks. -- David Marchand On Thu, May 1, 2014 at 5:00 PM, Burakov, Anatoly wrote: > Hi David, > > > Looking at bsd implementation, we can see that there is a potential mem > > leak in linux implementation. Fix this. > > > > Signed-off-by: David Marchand > > --- > > lib/librte_eal/linuxapp/eal/eal_pci.c | 1 + > > 1 file changed, 1 insertion(+) > > > > 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 = pci_map_resource(dev, > > NULL, devname, (off_t)offset, > > (size_t)maps[j].size)) == NULL) { > > + rte_free(uio_res); > > return (-1); > > } > > > > -- > > 1.7.10.4 > > Actually, there's another possible mem leak, right after uio_res = > rte_zmalloc(): > > /* collect info about device mappings */ > if ((nb_maps = 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 > > >