summaryrefslogtreecommitdiffstats
path: root/engines/e_dasync.c
diff options
context:
space:
mode:
Diffstat (limited to 'engines/e_dasync.c')
-rw-r--r--engines/e_dasync.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/engines/e_dasync.c b/engines/e_dasync.c
index b817b2ba5f..4eb50d055c 100644
--- a/engines/e_dasync.c
+++ b/engines/e_dasync.c
@@ -348,9 +348,19 @@ void engine_load_dasync_int(void)
ENGINE *toadd = engine_dasync();
if (!toadd)
return;
+ ERR_set_mark();
ENGINE_add(toadd);
+ /*
+ * If the "add" worked, it gets a structural reference. So either way, we
+ * release our just-created reference.
+ */
ENGINE_free(toadd);
- 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();
}
static int dasync_init(ENGINE *e)