1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

Fix leak caused by undestroyed pthread mutex

This commit is contained in:
Sterling Jensen 2016-05-12 20:22:35 -05:00 committed by Andy Green
parent bf31c1bc87
commit ecaed5ec94
2 changed files with 9 additions and 0 deletions

View file

@ -850,6 +850,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

View file

@ -1616,6 +1616,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)
{
@ -1629,6 +1636,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