* [dpdk-dev] [PATCH] lpm: fix freeing memory
@ 2016-11-03 10:15 Wei Dai
2016-11-06 22:46 ` Thomas Monjalon
0 siblings, 1 reply; 2+ messages in thread
From: Wei Dai @ 2016-11-03 10:15 UTC (permalink / raw)
To: dev, mb
The memory pointed by lpm->rules_tbl should also be freed
when memory malloc for tbl8 fails in rte_lpm_create_v1604( ).
And the memory pointed by lpm->tbl8 should also be freed
when the lpm object is freed in rte_lpm_free_v1604( ).
Fixes: f1f7261838b3 ("lpm: add a new config structure for IPv4")
Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
Signed-off-by: Wei Dai <wei.dai@intel.com>
---
lib/librte_lpm/rte_lpm.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c
index ec67765..8c15c4c 100644
--- a/lib/librte_lpm/rte_lpm.c
+++ b/lib/librte_lpm/rte_lpm.c
@@ -321,6 +321,7 @@ rte_lpm_create_v1604(const char *name, int socket_id,
if (lpm->tbl8 == NULL) {
RTE_LOG(ERR, LPM, "LPM tbl8 memory allocation failed\n");
+ rte_free(lpm->rules_tbl);
rte_free(lpm);
lpm = NULL;
rte_free(te);
@@ -402,6 +403,7 @@ rte_lpm_free_v1604(struct rte_lpm *lpm)
rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK);
+ rte_free(lpm->tbl8);
rte_free(lpm->rules_tbl);
rte_free(lpm);
rte_free(te);
--
2.7.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dpdk-dev] [PATCH] lpm: fix freeing memory
2016-11-03 10:15 [dpdk-dev] [PATCH] lpm: fix freeing memory Wei Dai
@ 2016-11-06 22:46 ` Thomas Monjalon
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2016-11-06 22:46 UTC (permalink / raw)
To: Wei Dai, mb; +Cc: dev
2016-11-03 18:15, Wei Dai:
> The memory pointed by lpm->rules_tbl should also be freed
> when memory malloc for tbl8 fails in rte_lpm_create_v1604( ).
> And the memory pointed by lpm->tbl8 should also be freed
> when the lpm object is freed in rte_lpm_free_v1604( ).
>
> Fixes: f1f7261838b3 ("lpm: add a new config structure for IPv4")
>
> Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
> Signed-off-by: Wei Dai <wei.dai@intel.com>
Applied, thanks
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-11-06 22:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-03 10:15 [dpdk-dev] [PATCH] lpm: fix freeing memory Wei Dai
2016-11-06 22:46 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).