summaryrefslogtreecommitdiffstats
path: root/src/utils/knotd/main.c
diff options
context:
space:
mode:
authorJan Hák <jan.hak@nic.cz>2022-08-02 14:19:23 +0200
committerDaniel Salzman <daniel.salzman@nic.cz>2022-08-02 14:43:40 +0200
commit118acb455453338d68117125a80ef385d3323985 (patch)
treef403dbae628049079fc6e69daaae6065f903290e /src/utils/knotd/main.c
parentdnssec: add key label setting to "zone_name key_type" (diff)
downloadknot-118acb455453338d68117125a80ef385d3323985.tar.xz
knot-118acb455453338d68117125a80ef385d3323985.zip
knotd: fix SIGSEGV when deinitialize global pkcs11 module
Diffstat (limited to 'src/utils/knotd/main.c')
-rw-r--r--src/utils/knotd/main.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/utils/knotd/main.c b/src/utils/knotd/main.c
index 01de271d1..d795456cd 100644
--- a/src/utils/knotd/main.c
+++ b/src/utils/knotd/main.c
@@ -466,7 +466,6 @@ int main(int argc, char **argv)
/* Initialize cryptographic backend. */
dnssec_crypto_init();
- atexit(dnssec_crypto_cleanup);
/* Initialize pseudorandom number generator. */
srand(time(NULL));
@@ -481,6 +480,7 @@ int main(int argc, char **argv)
int ret = set_config(confdb, config, max_conf_size);
if (ret != KNOT_EOK) {
log_close();
+ dnssec_crypto_cleanup();
return EXIT_FAILURE;
}
@@ -494,6 +494,7 @@ int main(int argc, char **argv)
log_fatal("failed to initialize server (%s)", knot_strerror(ret));
conf_free(conf());
log_close();
+ dnssec_crypto_cleanup();
return EXIT_FAILURE;
}
@@ -506,6 +507,7 @@ int main(int argc, char **argv)
server_deinit(&server);
conf_free(conf());
log_close();
+ dnssec_crypto_cleanup();
return EXIT_FAILURE;
}
@@ -527,6 +529,7 @@ int main(int argc, char **argv)
conf_free(conf());
systemd_dbus_close();
log_close();
+ dnssec_crypto_cleanup();
return EXIT_FAILURE;
}
@@ -545,6 +548,7 @@ int main(int argc, char **argv)
conf_free(conf());
systemd_dbus_close();
log_close();
+ dnssec_crypto_cleanup();
return EXIT_FAILURE;
}
@@ -582,9 +586,10 @@ int main(int argc, char **argv)
server_deinit(&server);
rcu_unregister_thread();
pid_cleanup();
+ conf_free(conf());
systemd_dbus_close();
log_close();
- conf_free(conf());
+ dnssec_crypto_cleanup();
return EXIT_FAILURE;
}
@@ -617,5 +622,7 @@ int main(int argc, char **argv)
log_info("shutting down");
log_close();
+ dnssec_crypto_cleanup();
+
return EXIT_SUCCESS;
}