Fix a merge mistake in engne_list_add
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Fri, 15 Sep 2023 07:56:01 +0000 (09:56 +0200)
committerBernd Edlinger <bernd.edlinger@hotmail.de>
Fri, 15 Sep 2023 07:56:01 +0000 (09:56 +0200)
master version increments the struct_ref early
and needs to decrement the struct_ref on error,
while 3.1 and 3.0 increment the struct_ref later.

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22115)

crypto/engine/eng_list.c

index d3bd0c0dc23db0cc3ae660c85f8a6d2965e15e23..d9e620dc58680ad0e5e547d56388353670df4212 100644 (file)
@@ -82,7 +82,6 @@ static int engine_list_add(ENGINE *e)
          * The first time the list allocates, we should register the cleanup.
          */
         if (!engine_cleanup_add_last(engine_list_cleanup)) {
-            CRYPTO_DOWN_REF(&e->struct_ref, &ref);
             ERR_raise(ERR_LIB_ENGINE, ENGINE_R_INTERNAL_LIST_ERROR);
             return 0;
         }