eal: fix memory leak on control thread failure

params is not freed if pthread_create() fails. The fix is
straight-forward.

Fixes: 3d09a6e26d ("eal: fix threads block on barrier")

Reported-by: Olivier Matz <olivier.matz@6wind.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
This commit is contained in:
Jianfeng Tan 2018-05-02 10:26:32 +00:00 committed by Thomas Monjalon
parent af7551e2bf
commit e87923a9be

View File

@ -178,8 +178,10 @@ rte_ctrl_thread_create(pthread_t *thread, const char *name,
pthread_barrier_init(&params->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);