From 54eecf32a981cb4584a362688bf778f06562dfa6 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Mon, 17 Aug 2015 01:36:53 +0200 Subject: [PATCH] test: plug small memory leak in unix test runner MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Join the watchdog thread unconditionally on exit. Fixes the following harmless but noisy memory leak: 576 bytes in 1 blocks are possibly lost in loss record 1 of 2 at 0x4C2A9C7: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x40121B4: _dl_allocate_tls (in /usr/lib64/ld-2.21.so) by 0x5AEA045: pthread_create@@GLIBC_2.2.5 (in /usr/lib64/libpthread-2.21.so) by 0x450D3E: process_wait (runner-unix.c:212) by 0x4067F1: run_test (runner.c:284) by 0x405EC3: maybe_run_test (run-tests.c:180) by 0x4058AD: main (run-tests.c:57) PR-URL: https://github.com/libuv/libuv/pull/479 Reviewed-By: Saúl Ibarra Corretgé --- test/runner-unix.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/test/runner-unix.c b/test/runner-unix.c index be921dea..2264d1e8 100644 --- a/test/runner-unix.c +++ b/test/runner-unix.c @@ -267,15 +267,11 @@ int process_wait(process_info_t* vec, int n, int timeout) { kill(p->pid, SIGTERM); } retval = -2; - - /* Wait for thread to finish. */ - r = pthread_join(tid, NULL); - if (r) { - perror("pthread_join"); - retval = -1; - } } + if (pthread_join(tid, NULL)) + abort(); + terminate: close(args.pipe[0]); close(args.pipe[1]);