<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi,<div class=""><br class=""></div><div class="">In some weird cases function lws_context_deinit_ssl_library() is called twice (I believe it’s my fault, but anyway).</div><div class=""><br class=""></div><div class="">I propose the following patch to prevent second free attempt:</div><div class="">==================================================</div><div class=""><div class="">diff --git a/lib/tls/openssl/openssl-tls.c b/lib/tls/openssl/openssl-tls.c</div><div class="">index e79e6d1d..de44a34e 100644</div><div class="">--- a/lib/tls/openssl/openssl-tls.c</div><div class="">+++ b/lib/tls/openssl/openssl-tls.c</div><div class="">@@ -93,7 +93,7 @@ lws_tls_err_describe_clear(void)</div><div class=""> </div><div class=""> #if LWS_MAX_SMP != 1</div><div class=""> </div><div class="">-static pthread_mutex_t *openssl_mutexes;</div><div class="">+static pthread_mutex_t *openssl_mutexes = NULL;</div><div class=""> </div><div class=""> static void</div><div class=""> lws_openssl_lock_callback(int mode, int type, const char *file, int line)</div><div class="">@@ -203,9 +203,13 @@ lws_context_deinit_ssl_library(struct lws_context *context)</div><div class=""> </div><div class="">        CRYPTO_set_locking_callback(NULL);</div><div class=""> </div><div class="">-       for (n = 0; n < CRYPTO_num_locks(); n++)</div><div class="">-               pthread_mutex_destroy(&openssl_mutexes[n]);</div><div class="">+  if(openssl_mutexes)</div><div class="">+  {</div><div class="">+    for (n = 0; n < CRYPTO_num_locks(); n++)</div><div class="">+      pthread_mutex_destroy(&openssl_mutexes[n]);</div><div class=""> </div><div class="">-       OPENSSL_free(openssl_mutexes);</div><div class="">+    OPENSSL_free(openssl_mutexes);</div><div class="">+    openssl_mutexes = NULL;</div><div class="">+  }</div><div class=""> #endif</div><div class=""> }</div></div><div class=""><div class="">==================================================</div><div class=""></div></div><div class=""><br class=""><div class="">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">— <br class="">With respect, M.<br class="">Public GnuPG key: 0x01731B47DBD56C0F<br class="">fpr: 0226 54EE C1FF 8636 36EF  2AC9 BCE9 CFC7 9CF4 6747</div>
</div>

<br class=""></div></body></html>