[dpdk-dev] [PATCH] member: fix memory leak on error

Wang, Yipeng1 yipeng1.wang at intel.com
Fri Dec 22 01:01:30 CET 2017


Thank you Anatoly for finding this issue. In the code I tried to reuse the rte_member_free function to free memory but it may not be executed through. 

Because of this, I may not properly release setsum struct neither. I will post a fix for both soon.

Thanks

>-----Original Message-----
>From: Burakov, Anatoly
>Sent: Thursday, December 21, 2017 9:51 AM
>To: dev at dpdk.org
>Cc: Wang, Yipeng1 <yipeng1.wang at intel.com>; Gobriel, Sameh
><sameh.gobriel at intel.com>
>Subject: [PATCH] member: fix memory leak on error
>
>rte_member may have allocated a tailq entry before failure, so
>free it.
>
>Fixes: 857ed6c68cf2 ("member: implement main API")
>Cc: yipeng1.wang at intel.com
>Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
>---
> lib/librte_member/rte_member.c | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/lib/librte_member/rte_member.c
>b/lib/librte_member/rte_member.c
>index cc9ea84..569fff9 100644
>--- a/lib/librte_member/rte_member.c
>+++ b/lib/librte_member/rte_member.c
>@@ -191,6 +191,7 @@ rte_member_create(const struct
>rte_member_parameters *params)
> 	return setsum;
>
> error_unlock_exit:
>+	rte_free(te);
> 	rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK);
> 	rte_member_free(setsum);
> 	return NULL;
>--
>2.7.4


More information about the dev mailing list