[dpdk-dev] pci:fix missing free

Message ID 1475113270-21983-1-git-send-email-zhouyates@gmail.com
State Accepted, archived
Headers show

Commit Message

Yangchao Zhou Sept. 29, 2016, 1:41 a.m.
Signed-off-by: Yangchao Zhou <zhouyates@gmail.com>
---
 lib/librte_eal/common/eal_common_pci.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Comments

David Marchand Sept. 30, 2016, 3:19 p.m. | #1
Hello,

On Thu, Sep 29, 2016 at 3:41 AM, Yangchao Zhou <zhouyates@gmail.com> wrote:
> Signed-off-by: Yangchao Zhou <zhouyates@gmail.com>
> ---
>  lib/librte_eal/common/eal_common_pci.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
> index 7248c38..eb44998 100644
> --- a/lib/librte_eal/common/eal_common_pci.c
> +++ b/lib/librte_eal/common/eal_common_pci.c
> @@ -378,6 +378,7 @@ rte_eal_pci_detach(const struct rte_pci_addr *addr)
>                         goto err_return;
>
>                 TAILQ_REMOVE(&pci_device_list, dev, next);
> +               free(dev);
>                 return 0;
>         }
>         return -1;
> --
> 1.7.1
>

For the title, how about:
pci: fix memory leak when detaching devices

Afaics the fixes tag would be :

Fixes: dbe6b4b61b0e ("pci: probe or close device")

+ CC stable
David Marchand Sept. 30, 2016, 3:27 p.m. | #2
On Fri, Sep 30, 2016 at 5:19 PM, David Marchand
<david.marchand@6wind.com> wrote:
> Hello,
>
> On Thu, Sep 29, 2016 at 3:41 AM, Yangchao Zhou <zhouyates@gmail.com> wrote:
>> Signed-off-by: Yangchao Zhou <zhouyates@gmail.com>
>> ---
>>  lib/librte_eal/common/eal_common_pci.c |    1 +
>>  1 files changed, 1 insertions(+), 0 deletions(-)
>>
>> diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
>> index 7248c38..eb44998 100644
>> --- a/lib/librte_eal/common/eal_common_pci.c
>> +++ b/lib/librte_eal/common/eal_common_pci.c
>> @@ -378,6 +378,7 @@ rte_eal_pci_detach(const struct rte_pci_addr *addr)
>>                         goto err_return;
>>
>>                 TAILQ_REMOVE(&pci_device_list, dev, next);
>> +               free(dev);
>>                 return 0;
>>         }
>>         return -1;
>> --
>> 1.7.1
>>
>
> For the title, how about:
> pci: fix memory leak when detaching devices
>
> Afaics the fixes tag would be :
>
> Fixes: dbe6b4b61b0e ("pci: probe or close device")
>
> + CC stable

Thomas, can you apply this with my ack ?
Thanks.
Thomas Monjalon Oct. 4, 2016, 8:07 a.m. | #3
2016-09-30 17:27, David Marchand:
> On Fri, Sep 30, 2016 at 5:19 PM, David Marchand
> <david.marchand@6wind.com> wrote:
> > Hello,
> >
> > On Thu, Sep 29, 2016 at 3:41 AM, Yangchao Zhou <zhouyates@gmail.com> wrote:
> >> Signed-off-by: Yangchao Zhou <zhouyates@gmail.com>
> >
> > For the title, how about:
> > pci: fix memory leak when detaching devices
> >
> > Afaics the fixes tag would be :
> >
> > Fixes: dbe6b4b61b0e ("pci: probe or close device")
> >
> > + CC stable
> 
> Thomas, can you apply this with my ack ?
> Thanks.

Applied, thanks

Patch

diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 7248c38..eb44998 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -378,6 +378,7 @@  rte_eal_pci_detach(const struct rte_pci_addr *addr)
 			goto err_return;
 
 		TAILQ_REMOVE(&pci_device_list, dev, next);
+		free(dev);
 		return 0;
 	}
 	return -1;