Index | Thread | Search

From:
Job Snijders <job@openbsd.org>
Subject:
rpki-client: cleanup mutexes and conditional variables
To:
tech@openbsd.org
Date:
Mon, 23 Jun 2025 23:25:30 +0000

Download raw body.

Thread
Free the pthreads mutex and conditional variable memory allocations.
Spotted by tb@

OK?

Index: parser.c
===================================================================
RCS file: /cvs/src/usr.sbin/rpki-client/parser.c,v
diff -u -p -r1.158 parser.c
--- parser.c	23 Jun 2025 22:01:14 -0000	1.158
+++ parser.c	23 Jun 2025 23:21:50 -0000
@@ -1301,6 +1301,15 @@ proc_parser(int fd, int nthreads)
 
 	msgbuf_free(inbufq);
 	ibufq_free(globalmsgq);
+
+	if (pthread_mutex_destroy(&globalq_mtx) != 0)
+		errx(1, "pthread_mutex_destroy");
+	if (pthread_cond_destroy(&globalq_cond) != 0)
+		errx(1, "pthread_cond_destroy");
+	if (pthread_mutex_destroy(&globalmsgq_mtx) != 0)
+		errx(1, "pthread_mutex_destroy");
+	if (pthread_cond_destroy(&globalmsgq_cond) != 0)
+		errx(1, "pthread_cond_destroy");
 
 	if (certid > CERTID_MAX)
 		errx(1, "processing incomplete: too many certificates");