]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-ssl-iostream: Unload ssl_iostream_openssl plugin at exit.
authorTimo Sirainen <tss@iki.fi>
Tue, 6 Nov 2012 21:49:57 +0000 (23:49 +0200)
committerTimo Sirainen <tss@iki.fi>
Tue, 6 Nov 2012 21:49:57 +0000 (23:49 +0200)
src/lib-ssl-iostream/iostream-ssl.c

index 71e6bad54d831b54c9343aac00f71238c19be65a..f8e069691f2a8d18ab41237b68a6e075740406c6 100644 (file)
@@ -4,12 +4,21 @@
 #include "module-dir.h"
 #include "iostream-ssl-private.h"
 
+#include <stdlib.h>
+
 static bool ssl_module_loaded = FALSE;
 #ifdef HAVE_SSL
 static struct module *ssl_module = NULL;
 #endif
 static const struct iostream_ssl_vfuncs *ssl_vfuncs = NULL;
 
+#ifdef HAVE_SSL
+static void ssl_module_unload(void)
+{
+       module_dir_unload(&ssl_module);
+}
+#endif
+
 static int ssl_module_load(void)
 {
 #ifdef HAVE_SSL
@@ -24,6 +33,8 @@ static int ssl_module_load(void)
        ssl_vfuncs = module_get_symbol(ssl_module, "ssl_vfuncs");
        if (ssl_vfuncs == NULL)
                i_fatal("%s: ssl_vfuncs symbol not found", plugin_name);
+
+       atexit(ssl_module_unload);
        ssl_module_loaded = TRUE;
        return 0;
 #else