aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo Buehler <tb@openbsd.org>2026-08-10 09:09:54 +0200
committerTheo Buehler <tb@openbsd.org>2026-08-10 09:09:54 +0200
commitd1b412a6bc0807d8b825d7627101232a7cd796bc (patch)
tree127cb9337e0c63b56bbadef30953d898058649ea
parent11918d2008d0999f128a0952b990a3971a7d410e (diff)
parent2489ccf3d8af2299866276b4c58741a345a16d13 (diff)
downloadportable-d1b412a6bc0807d8b825d7627101232a7cd796bc.tar.gz
portable-d1b412a6bc0807d8b825d7627101232a7cd796bc.tar.bz2
portable-d1b412a6bc0807d8b825d7627101232a7cd796bc.zip
Land #1353 - fix pthread_mutex_destroy() for statically initialized never locked mutexes
-rw-r--r--include/compat/pthread.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/compat/pthread.h b/include/compat/pthread.h
index 8211dda..7702dcd 100644
--- a/include/compat/pthread.h
+++ b/include/compat/pthread.h
@@ -110,8 +110,11 @@ pthread_mutex_unlock(pthread_mutex_t *mutex)
110static inline int 110static inline int
111pthread_mutex_destroy(pthread_mutex_t *mutex) 111pthread_mutex_destroy(pthread_mutex_t *mutex)
112{ 112{
113 DeleteCriticalSection(mutex->lock); 113 if (mutex->lock != NULL) {
114 free(mutex->lock); 114 DeleteCriticalSection(mutex->lock);
115 free(mutex->lock);
116 mutex->lock = NULL;
117 }
115 return 0; 118 return 0;
116} 119}
117 120