mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
Merge branch '3838-named-rrchecker-should-cleanup-when-it-detects-an-error-v9_18' into 'v9_18'
[9.18] named-rrchecker: have fatal cleanup See merge request isc-projects/bind9!7492
This commit is contained in:
commit
797c665c25
1 changed files with 13 additions and 3 deletions
|
|
@ -52,6 +52,17 @@ usage(void) {
|
|||
exit(0);
|
||||
}
|
||||
|
||||
static void
|
||||
cleanup(void) {
|
||||
if (lex != NULL) {
|
||||
isc_lex_close(lex);
|
||||
isc_lex_destroy(&lex);
|
||||
}
|
||||
if (mctx != NULL) {
|
||||
isc_mem_destroy(&mctx);
|
||||
}
|
||||
}
|
||||
|
||||
noreturn static void
|
||||
fatal(const char *format, ...);
|
||||
|
||||
|
|
@ -64,6 +75,7 @@ fatal(const char *format, ...) {
|
|||
vfprintf(stderr, format, args);
|
||||
va_end(args);
|
||||
fputc('\n', stderr);
|
||||
cleanup();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
@ -329,8 +341,6 @@ main(int argc, char *argv[]) {
|
|||
fflush(stdout);
|
||||
}
|
||||
|
||||
isc_lex_close(lex);
|
||||
isc_lex_destroy(&lex);
|
||||
isc_mem_destroy(&mctx);
|
||||
cleanup();
|
||||
return (0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue