diff --git a/bin/dig/dig.c b/bin/dig/dig.c index f4f95c9e40..a2ceb4d14d 100644 --- a/bin/dig/dig.c +++ b/bin/dig/dig.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: dig.c,v 1.53 2000/06/29 05:21:08 mws Exp $ */ +/* $Id: dig.c,v 1.54 2000/06/30 14:11:45 mws Exp $ */ #include #include @@ -25,6 +25,7 @@ extern int h_errno; #include #include #include +#include #include #include @@ -63,6 +64,7 @@ extern char keynametext[MXNAME]; extern char keysecret[MXNAME]; extern dns_tsigkey_t *key; extern isc_boolean_t validated; +extern isc_taskmgr_t *taskmgr; extern isc_boolean_t debugging; extern isc_boolean_t isc_mem_debugging; @@ -992,7 +994,7 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) { show_usage(); exit (exitcode); } else if (strcmp(rv[0], "-memdebug") == 0) { - isc_mem_debugging = ISC_TRUE; + isc_mem_debugging = 1; } else if (strcmp(rv[0], "-debug") == 0) { debugging = ISC_TRUE; } else if (strncmp(rv[0], "-x", 2) == 0) { @@ -1221,9 +1223,13 @@ main(int argc, char **argv) { setup_system(); start_lookup(); isc_app_run(); + isc_app_finish(); + if (taskmgr != NULL) { + debug ("Freeing taskmgr"); + isc_taskmgr_destroy(&taskmgr); + } if (isc_mem_debugging) isc_mem_stats(mctx, stderr); - isc_app_finish(); if (mctx != NULL) isc_mem_destroy(&mctx); return (exitcode); diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index c97aedd308..b96b722a5b 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: dighost.c,v 1.63 2000/06/29 07:43:46 explorer Exp $ */ +/* $Id: dighost.c,v 1.64 2000/06/30 14:11:46 mws Exp $ */ /* * Notice to programmers: Do not use this code as an example of how to @@ -2021,6 +2021,7 @@ free_lists(int _exitcode) { debug ("Freeing global server %p", s); ptr = s; s = ISC_LIST_NEXT(s, link); + debug ("ptr is now %p", ptr); isc_mem_free(mctx, ptr); } o = ISC_LIST_HEAD(search_list); @@ -2042,10 +2043,6 @@ free_lists(int _exitcode) { debug ("Freeing task"); isc_task_detach(&global_task); } - if (taskmgr != NULL) { - debug ("Freeing taskmgr"); - isc_taskmgr_destroy(&taskmgr); - } if (key != NULL) { debug ("Freeing key %p", key); dns_tsigkey_setdeleted(key); diff --git a/bin/dig/host.c b/bin/dig/host.c index 29594713d6..8cd509a337 100644 --- a/bin/dig/host.c +++ b/bin/dig/host.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: host.c,v 1.31 2000/06/29 05:21:11 mws Exp $ */ +/* $Id: host.c,v 1.32 2000/06/30 14:11:48 mws Exp $ */ #include #include @@ -30,6 +30,7 @@ extern int h_errno; #include #include #include +#include #include @@ -50,6 +51,7 @@ extern int ndots; extern int tries; extern int lookup_counter; extern int exitcode; +extern isc_taskmgr_t *taskmgr; isc_boolean_t short_form = ISC_TRUE, filter = ISC_FALSE, @@ -696,6 +698,10 @@ main(int argc, char **argv) { setup_system(); start_lookup(); isc_app_run(); + if (taskmgr != NULL) { + debug ("Freeing taskmgr"); + isc_taskmgr_destroy(&taskmgr); + } if (isc_mem_debugging) isc_mem_stats(mctx, stderr); isc_app_finish(); diff --git a/bin/dig/nslookup.c b/bin/dig/nslookup.c index b459a9914a..070e8ec7ae 100644 --- a/bin/dig/nslookup.c +++ b/bin/dig/nslookup.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: nslookup.c,v 1.21 2000/06/29 05:21:12 mws Exp $ */ +/* $Id: nslookup.c,v 1.22 2000/06/30 14:11:49 mws Exp $ */ #include @@ -36,6 +36,7 @@ extern int h_errno; #include #include #include +#include #include @@ -57,6 +58,7 @@ extern int tries; extern int lookup_counter; extern char fixeddomain[MXNAME]; extern int exitcode; +extern isc_taskmgr_t *taskmgr; isc_boolean_t short_form = ISC_TRUE, printcmd = ISC_TRUE, filter = ISC_FALSE, showallsoa = ISC_FALSE, @@ -875,6 +877,10 @@ main(int argc, char **argv) { free_lists(0); isc_mutex_destroy(&lock); isc_condition_destroy(&cond); + if (taskmgr != NULL) { + debug ("Freeing taskmgr"); + isc_taskmgr_destroy(&taskmgr); + } if (isc_mem_debugging) isc_mem_stats(mctx, stderr); isc_app_finish();