]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
delay method store free in context_deinit_objs
authorNeil Horman <nhorman@openssl.org>
Fri, 8 May 2026 23:16:28 +0000 (19:16 -0400)
committerNeil Horman <nhorman@openssl.org>
Thu, 25 Jun 2026 21:25:43 +0000 (17:25 -0400)
Reviewed-by: Bob Beck <beck@openssl.org>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Thu Jun 25 21:26:15 2026
(Merged from https://github.com/openssl/openssl/pull/31143)

crypto/context.c

index 3596c0e0683aa32b82ba363cf657132ca61de84f..66d7e429556ce5ce90aea2088c6c580d808e15cb 100644 (file)
@@ -255,12 +255,6 @@ err:
 
 static void context_deinit_objs(OSSL_LIB_CTX *ctx)
 {
-    /* P2. We want evp_method_store to be cleaned up before the provider store */
-    if (ctx->evp_method_store != NULL) {
-        ossl_method_store_free(ctx->evp_method_store);
-        ctx->evp_method_store = NULL;
-    }
-
     /* P2. */
     if (ctx->drbg != NULL) {
         ossl_rand_ctx_free(ctx->drbg);
@@ -278,14 +272,14 @@ static void context_deinit_objs(OSSL_LIB_CTX *ctx)
      * P2. We want decoder_store/decoder_cache to be cleaned up before the
      * provider store
      */
-    if (ctx->decoder_store != NULL) {
-        ossl_method_store_free(ctx->decoder_store);
-        ctx->decoder_store = NULL;
-    }
     if (ctx->decoder_cache != NULL) {
         ossl_decoder_cache_free(ctx->decoder_cache);
         ctx->decoder_cache = NULL;
     }
+    if (ctx->decoder_store != NULL) {
+        ossl_method_store_free(ctx->decoder_store);
+        ctx->decoder_store = NULL;
+    }
 
     /* P2. We want encoder_store to be cleaned up before the provider store */
     if (ctx->encoder_store != NULL) {
@@ -306,6 +300,12 @@ static void context_deinit_objs(OSSL_LIB_CTX *ctx)
         ctx->provider_store = NULL;
     }
 
+    /* P2. We want evp_method_store to be cleaned up before the provider store */
+    if (ctx->evp_method_store != NULL) {
+        ossl_method_store_free(ctx->evp_method_store);
+        ctx->evp_method_store = NULL;
+    }
+
     /* Default priority. */
     if (ctx->property_string_data != NULL) {
         ossl_property_string_data_free(ctx->property_string_data);