[dpdk-dev] [PATCH 1/7] pci: fix potential mem leak

Burakov, Anatoly anatoly.burakov at intel.com
Thu May 1 17:00:21 CEST 2014


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 <david.marchand at 6wind.com>
> ---
>  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

 


More information about the dev mailing list