File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -119,8 +119,7 @@ static void* client_thread(void* args)
119119 } while (ret <= 0 &&
120120 ((err == WOLFSSL_ERROR_WANT_READ ) || (err == WOLFSSL_ERROR_WANT_WRITE )));
121121
122- /* clean up, wolfSSL_free would also free the WOLFSSL_BIO's so set as NULL
123- * since they are also being used with srv_ssl and will be free'd there. */
122+ /* drops this thread's BIO references; srv_ssl still holds its own */
124123 wolfSSL_set_bio (cli_ssl , NULL , NULL );
125124 wolfSSL_free (cli_ssl );
126125 wolfSSL_CTX_free (cli_ctx );
@@ -147,6 +146,10 @@ int main()
147146
148147 io .rbio = wolfSSL_BIO_new (wolfSSL_BIO_s_mem ());
149148 io .wbio = wolfSSL_BIO_new (wolfSSL_BIO_s_mem ());
149+ /* cli_ssl and srv_ssl both use these, so take the second reference here or
150+ * whichever side cleans up first frees them under the other. */
151+ wolfSSL_BIO_up_ref (io .rbio );
152+ wolfSSL_BIO_up_ref (io .wbio );
150153 sem_init (& io .bioSem , 0 , 1 );
151154
152155 /* set up server */
You can’t perform that action at this time.
0 commit comments