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

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

Btw, Pablo, since I remember I refer to the EFD library on my membership implementation, does EFD have similar memory leakage issue that not releasing te when failure?


>-----Original Message-----
>From: Wang, Yipeng1
>Sent: Thursday, December 21, 2017 4:01 PM
>To: Burakov, Anatoly <anatoly.burakov at intel.com>; dev at dpdk.org
>Cc: Gobriel, Sameh <sameh.gobriel at intel.com>
>Subject: RE: [PATCH] member: fix memory leak on error
>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
>Because of this, I may not properly release setsum struct neither. I will post a
>fix for both soon.
>>-----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
>>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;

More information about the dev mailing list