]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
openssl: first unload the provider, then free the context
authorDaniel Stenberg <daniel@haxx.se>
Tue, 29 Apr 2025 09:52:47 +0000 (11:52 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 29 Apr 2025 10:45:23 +0000 (12:45 +0200)
Doing it in the reversed order causes bad problems inside OpenSSL.

Closes #17223

lib/vtls/openssl.c

index 94e2de97364e04a171dae7dca63fbfffa464625e..96b2d88552216cf450e95327f5c7fe7ec934cd85 100644 (file)
@@ -1947,9 +1947,6 @@ static struct curl_slist *ossl_engines_list(struct Curl_easy *data)
 
 static void ossl_provider_cleanup(struct Curl_easy *data)
 {
-  OSSL_LIB_CTX_free(data->state.libctx);
-  data->state.libctx = NULL;
-  Curl_safefree(data->state.propq);
   if(data->state.baseprov) {
     OSSL_PROVIDER_unload(data->state.baseprov);
     data->state.baseprov = NULL;
@@ -1958,6 +1955,9 @@ static void ossl_provider_cleanup(struct Curl_easy *data)
     OSSL_PROVIDER_unload(data->state.provider);
     data->state.provider = NULL;
   }
+  OSSL_LIB_CTX_free(data->state.libctx);
+  data->state.libctx = NULL;
+  Curl_safefree(data->state.propq);
   data->state.provider_loaded = FALSE;
 }