From cbc8615f94399c415f9b6ceaa5d4419c3da53a97 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Thu, 30 Jun 2022 10:32:31 +0200 Subject: [PATCH] Please valgrind. --- examples/sthread/pthread-mutex-simple.c | 2 ++ examples/sthread/sthread-mutex-simple.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/sthread/pthread-mutex-simple.c b/examples/sthread/pthread-mutex-simple.c index d46d75adf7..d97bfe8ca1 100644 --- a/examples/sthread/pthread-mutex-simple.c +++ b/examples/sthread/pthread-mutex-simple.c @@ -27,6 +27,8 @@ int main(int argc, char* argv[]) pthread_join(thread1, NULL); pthread_join(thread2, NULL); + pthread_mutex_destroy(&mutex); + fprintf(stderr, "User's main is terminating.\n"); return 0; } diff --git a/examples/sthread/sthread-mutex-simple.c b/examples/sthread/sthread-mutex-simple.c index 3ab82670c8..c0f48f68c5 100644 --- a/examples/sthread/sthread-mutex-simple.c +++ b/examples/sthread/sthread-mutex-simple.c @@ -23,7 +23,9 @@ int main(int argc, char* argv[]) sthread_create(&thread2, NULL, thread_fun, NULL); sthread_join(thread1, NULL); sthread_join(thread2, NULL); - fprintf(stderr, "done\n"); + sthread_mutex_destroy(&mutex); + + fprintf(stderr, "done\n"); return 0; } -- 2.20.1