From: Jianfeng Tan Date: Wed, 2 May 2018 10:26:32 +0000 (+0000) Subject: eal: fix memory leak on control thread failure X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=e87923a9be65e0f3ebd1e45d116a2618b6dcfe07;p=dpdk.git eal: fix memory leak on control thread failure params is not freed if pthread_create() fails. The fix is straight-forward. Fixes: 3d09a6e26d8b ("eal: fix threads block on barrier") Reported-by: Olivier Matz Signed-off-by: Jianfeng Tan Reviewed-by: Olivier Matz --- diff --git a/lib/librte_eal/common/eal_common_thread.c b/lib/librte_eal/common/eal_common_thread.c index de69452eb8..a2c05e40fa 100644 --- a/lib/librte_eal/common/eal_common_thread.c +++ b/lib/librte_eal/common/eal_common_thread.c @@ -178,8 +178,10 @@ rte_ctrl_thread_create(pthread_t *thread, const char *name, pthread_barrier_init(¶ms->configured, NULL, 2); ret = pthread_create(thread, attr, rte_thread_init, (void *)params); - if (ret != 0) + if (ret != 0) { + free(params); return ret; + } if (name != NULL) { ret = rte_thread_setname(*thread, name);