openssl: first unload the provider, then free the context

Doing it in the reversed order causes bad problems inside OpenSSL.

Closes #17223
This commit is contained in:
Daniel Stenberg 2025-04-29 11:52:47 +02:00
parent cf1b709dff
commit 2fa3d528ae
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View 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;
}