Index | Thread | Search

From:
Claudio Jeker <cjeker@diehard.n-r-g.com>
Subject:
Re: rpki-client: cleanup mutexes and conditional variables
To:
Job Snijders <job@openbsd.org>
Cc:
tech@openbsd.org
Date:
Tue, 24 Jun 2025 07:30:27 +0200

Download raw body.

Thread
On Mon, Jun 23, 2025 at 11:25:30PM +0000, Job Snijders wrote:
> Free the pthreads mutex and conditional variable memory allocations.
> Spotted by tb@
> 
> OK?

All of those use static initalisation. So it is unclear to me if this
works on all systems. Documentation is very unclear here.
 
> 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");
> 

-- 
:wq Claudio