diff --git a/lib/context.c b/lib/context.c index ac7d7d86..b3f7c4ca 100644 --- a/lib/context.c +++ b/lib/context.c @@ -738,6 +738,7 @@ lws_context_destroy(struct lws_context *context) /* no protocol close */); n--; } + lws_pt_mutex_destroy(pt); } /* * give all extensions a chance to clean up any per-context diff --git a/lib/private-libwebsockets.h b/lib/private-libwebsockets.h index 4ed08953..23ec9e33 100644 --- a/lib/private-libwebsockets.h +++ b/lib/private-libwebsockets.h @@ -1613,6 +1613,13 @@ lws_pt_mutex_init(struct lws_context_per_thread *pt) { pthread_mutex_init(&pt->lock, NULL); } + +static LWS_INLINE void +lws_pt_mutex_destroy(struct lws_context_per_thread *pt) +{ + pthread_mutex_destroy(&pt->lock); +} + static LWS_INLINE void lws_pt_lock(struct lws_context_per_thread *pt) { @@ -1626,6 +1633,7 @@ lws_pt_unlock(struct lws_context_per_thread *pt) } #else #define lws_pt_mutex_init(_a) (void)(_a) +#define lws_pt_mutex_destroy(_a) (void)(_a) #define lws_pt_lock(_a) (void)(_a) #define lws_pt_unlock(_a) (void)(_a) #endif