aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2001-04-26 16:07:08 +0000
committerRichard Levitte <levitte@openssl.org>2001-04-26 16:07:08 +0000
commita679116f6fe24be5d2ddb16437ee86f77ac53947 (patch)
tree60738370bf896459dd56acef5df657777d7288b4
parent3988bb34aa77acc034ebf93fd70987f42b45f636 (diff)
downloadopenssl-a679116f6fe24be5d2ddb16437ee86f77ac53947.tar.gz
Provide the possibility to clean up internal ENGINE structures. This
takes care of what would otherwise be seen as a memory leak.
-rw-r--r--crypto/engine/engine.h3
-rw-r--r--crypto/engine/engine_list.c14
2 files changed, 17 insertions, 0 deletions
diff --git a/crypto/engine/engine.h b/crypto/engine/engine.h
index a85cfff87b..e129cde70c 100644
--- a/crypto/engine/engine.h
+++ b/crypto/engine/engine.h
@@ -349,6 +349,9 @@ int ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns);
/* Copies across all ENGINE methods and pointers. NB: This does *not* change
* reference counts however. */
int ENGINE_cpy(ENGINE *dest, const ENGINE *src);
+/* Cleans the internal engine structure. This should only be used when the
+ * application is about to exit. */
+void ENGINE_cleanup(void);
/* These return values from within the ENGINE structure. These can be useful
* with functional references as well as structural references - it depends
diff --git a/crypto/engine/engine_list.c b/crypto/engine/engine_list.c
index cc57e658ab..2ca667e85d 100644
--- a/crypto/engine/engine_list.c
+++ b/crypto/engine/engine_list.c
@@ -376,6 +376,20 @@ int ENGINE_free(ENGINE *e)
return 1;
}
+void ENGINE_cleanup(void)
+ {
+ ENGINE *iterator = engine_list_head;
+
+ while(iterator != NULL)
+ {
+ ENGINE_remove(iterator);
+ ENGINE_free(iterator);
+ iterator = engine_list_head;
+ }
+ engine_list_flag = 0;
+ return;
+ }
+
int ENGINE_set_id(ENGINE *e, const char *id)
{
if(id == NULL)