diff options
| author | Theo Buehler <tb@openbsd.org> | 2026-08-10 09:09:54 +0200 |
|---|---|---|
| committer | Theo Buehler <tb@openbsd.org> | 2026-08-10 09:09:54 +0200 |
| commit | d1b412a6bc0807d8b825d7627101232a7cd796bc (patch) | |
| tree | 127cb9337e0c63b56bbadef30953d898058649ea /include/compat/pthread.h | |
| parent | 11918d2008d0999f128a0952b990a3971a7d410e (diff) | |
| parent | 2489ccf3d8af2299866276b4c58741a345a16d13 (diff) | |
| download | portable-d1b412a6bc0807d8b825d7627101232a7cd796bc.tar.gz portable-d1b412a6bc0807d8b825d7627101232a7cd796bc.tar.bz2 portable-d1b412a6bc0807d8b825d7627101232a7cd796bc.zip | |
Land #1353 - fix pthread_mutex_destroy() for statically initialized never locked mutexes
Diffstat (limited to 'include/compat/pthread.h')
| -rw-r--r-- | include/compat/pthread.h | 7 |
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) | |||
| 110 | static inline int | 110 | static inline int |
| 111 | pthread_mutex_destroy(pthread_mutex_t *mutex) | 111 | pthread_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 | ||
