X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Ftincctl.c;h=664b2eaa1b4306761284afd2bb9b9aba3fb832e0;hb=f71ab70351e8d5dfdc91c9808d142cf93d2a5d61;hp=a6b400b905e0c523fc96e26d5457907cb8ae5776;hpb=f830d756812a2860fe3b758d3fd8605ac338a552;p=tinc diff --git a/src/tincctl.c b/src/tincctl.c index a6b400b9..664b2eaa 100644 --- a/src/tincctl.c +++ b/src/tincctl.c @@ -3339,6 +3339,11 @@ static int cmd_shell(int argc, char *argv[]) { return result; } +static void cleanup() { + free(tinc_conf); + free(hosts_dir); + free_names(); +} int main(int argc, char *argv[]) { program_name = argv[0]; @@ -3353,6 +3358,7 @@ int main(int argc, char *argv[]) { make_names(false); xasprintf(&tinc_conf, "%s" SLASH "tinc.conf", confbase); xasprintf(&hosts_dir, "%s" SLASH "hosts", confbase); + atexit(cleanup); if(show_version) { version(); @@ -3374,7 +3380,8 @@ int main(int argc, char *argv[]) { #endif - srand(time(NULL)); + gettimeofday(&now, NULL); + srand(now.tv_sec + now.tv_usec); crypto_init(); if(optind >= argc) {