return;
REF_ASSERT_ISNT(i < 0);
- CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL, s, &s->ex_data);
-
if (s->method != NULL)
s->method->ssl_free(s);
+ CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL, s, &s->ex_data);
SSL_CTX_free(s->ctx);
CRYPTO_THREAD_lock_free(s->lock);
CRYPTO_FREE_REF(&s->references);
if (s == NULL)
return;
- X509_VERIFY_PARAM_free(s->param);
- dane_final(&s->dane);
-
- /* Ignore return value */
+ /*
+ * Ignore return values. This could result in user callbacks being called
+ * e.g. for the QUIC TLS record layer. So we do this early before we have
+ * freed other things.
+ */
ssl_free_wbio_buffer(s);
-
- /* Ignore return value */
RECORD_LAYER_clear(&s->rlayer);
+ X509_VERIFY_PARAM_free(s->param);
+ dane_final(&s->dane);
+
BUF_MEM_free(s->init_buf);
/* add extra stuff */