[dpdk-dev,3/5] pmd ring: fix possible memory leak during devinit
Commit Message
Free kvlist on function exit to avoid memory leak.
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
---
lib/librte_pmd_ring/rte_eth_ring.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Comments
On 02/23/2015 03:09 PM, Pawel Wodkowski wrote:
> Free kvlist on function exit to avoid memory leak.
>
> Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
On 2015-02-24 12:05, Olivier MATZ wrote:
> On 02/23/2015 03:09 PM, Pawel Wodkowski wrote:
>> Free kvlist on function exit to avoid memory leak.
>>
>> Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
>
> Acked-by: Olivier Matz <olivier.matz@6wind.com>
>
Please have in mind that this patch depend on patch 2/5
On 02/24/2015 12:15 PM, Pawel Wodkowski wrote:
> On 2015-02-24 12:05, Olivier MATZ wrote:
>> On 02/23/2015 03:09 PM, Pawel Wodkowski wrote:
>>> Free kvlist on function exit to avoid memory leak.
>>>
>>> Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
>>
>> Acked-by: Olivier Matz <olivier.matz@6wind.com>
>>
>
> Please have in mind that this patch depend on patch 2/5
>
Indeed. I forgot to send the mail to ack the 2/5, sorry.
That's done now.
Thanks,
Olivier
@@ -527,7 +527,7 @@ out:
static int
rte_pmd_ring_devinit(const char *name, const char *params)
{
- struct rte_kvargs *kvlist;
+ struct rte_kvargs *kvlist = NULL;
int ret = 0;
struct node_action_list *info = NULL;
@@ -548,7 +548,7 @@ rte_pmd_ring_devinit(const char *name, const char *params)
info = rte_zmalloc("struct node_action_list", sizeof(struct node_action_list) +
(sizeof(struct node_action_pair) * ret), 0);
if (!info)
- goto out;
+ goto out_free;
info->total = ret;
info->list = (struct node_action_pair*)(info + 1);
@@ -567,8 +567,8 @@ rte_pmd_ring_devinit(const char *name, const char *params)
}
out_free:
+ rte_kvargs_free(kvlist);
rte_free(info);
-out:
return ret;
}