]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-var-expand: Unload loaded crypt module at exit
authorAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 16 May 2025 08:05:27 +0000 (11:05 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 16 May 2025 08:05:27 +0000 (11:05 +0300)
Forgotten in 73ae2a9e45144f05a179d17d9b201226d93b81a0

src/lib-var-expand/expansion-filter-crypt.c

index 0cab9dd5d763994aba8ab6a83c10c675bb135737..64b9b722628bb72abd75e87700aeebce99ce00c5 100644 (file)
@@ -10,6 +10,12 @@ static struct module *var_expand_crypt_module;
 static var_expand_filter_func_t *fn_encrypt = NULL;
 static var_expand_filter_func_t *fn_decrypt = NULL;
 
+static void var_expand_crypt_unload(void)
+{
+       fn_decrypt = fn_encrypt = NULL;
+       module_dir_unload(&var_expand_crypt_module);
+}
+
 void var_expand_crypt_load(void)
 {
        struct module_dir_load_settings set = {
@@ -23,6 +29,7 @@ void var_expand_crypt_load(void)
        var_expand_crypt_module =
                module_dir_load(VAR_EXPAND_MODULE_DIR, mods, &set);
        module_dir_init(var_expand_crypt_module);
+       lib_atexit(var_expand_crypt_unload);
 }
 
 void expansion_filter_crypt_set_functions(var_expand_filter_func_t *encrypt,