diff --git a/bin/dig/dig.c b/bin/dig/dig.c index d4867cc282..3e59f7f21a 100644 --- a/bin/dig/dig.c +++ b/bin/dig/dig.c @@ -3079,7 +3079,7 @@ void dig_shutdown(void) { destroy_lookup(default_lookup); if (atomic_load(&batchname) != 0) { - if (batchfp != stdin) { + if (batchfp != NULL && batchfp != stdin) { fclose(batchfp); } atomic_store(&batchname, 0);