X-Git-Url: https://git.openssl.org/gitweb/?a=blobdiff_plain;f=engines%2Fe_devcrypto.c;fp=engines%2Fe_devcrypto.c;h=85815e2e5aeacbbf206ec5da3116d87d53c6ed8e;hb=b9b2135d22b93f949fd77f293925fc66158416ff;hp=729bb1fe955af0fa694a030f26dc089cee48ed4f;hpb=b8ae4a83de0de38fd382f3981e503f2ab5461c07;p=openssl.git diff --git a/engines/e_devcrypto.c b/engines/e_devcrypto.c index 729bb1fe95..85815e2e5a 100644 --- a/engines/e_devcrypto.c +++ b/engines/e_devcrypto.c @@ -1287,9 +1287,20 @@ void engine_load_devcrypto_int(void) return; } + ERR_set_mark(); ENGINE_add(e); + /* + * If the "add" worked, it gets a structural reference. So either way, we + * release our just-created reference. + */ ENGINE_free(e); /* Loose our local reference */ - ERR_clear_error(); + /* + * If the "add" didn't work, it was probably a conflict because it was + * already added (eg. someone calling ENGINE_load_blah then calling + * ENGINE_load_builtin_engines() perhaps). + */ + ERR_pop_to_mark(); +} } #else