net/ark: fix leak on thread termination

A terminated pthread should be joined or detached so that its associated
resources are released.

The "ark-delay-pg" thread is just used to delay some task but it is never
joined by the thread that created it.
The easiest solution is to detach the new thread.

Fixes: 727b3fe292 ("net/ark: integrate PMD")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Ed Czeck <ed.czeck@atomicrules.com>
This commit is contained in:
David Marchand 2021-05-11 13:33:57 +02:00 committed by Ferruh Yigit
parent 99fc79b37a
commit b8b5dc6b95

View File

@ -3,6 +3,7 @@
*/ */
#include <unistd.h> #include <unistd.h>
#include <pthread.h>
#include <rte_string_fns.h> #include <rte_string_fns.h>
#include <rte_malloc.h> #include <rte_malloc.h>
@ -474,6 +475,7 @@ ark_pktgen_delay_start(void *arg)
* perform a blind sleep here to ensure that the external test * perform a blind sleep here to ensure that the external test
* application has time to setup the test before we generate packets * application has time to setup the test before we generate packets
*/ */
pthread_detach(pthread_self());
usleep(100000); usleep(100000);
ark_pktgen_run(inst); ark_pktgen_run(inst);
return NULL; return NULL;