diff --git a/lib/dns/zone.c b/lib/dns/zone.c index d943295588..7481d3b12f 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -6825,8 +6825,14 @@ zone_resigninc(dns_zone_t *zone) { } ZONEDB_LOCK(&zone->dblock, isc_rwlocktype_read); - dns_db_attach(zone->db, &db); + if (zone->db != NULL) { + dns_db_attach(zone->db, &db); + } ZONEDB_UNLOCK(&zone->dblock, isc_rwlocktype_read); + if (db == NULL) { + result = ISC_R_FAILURE; + goto failure; + } result = dns_db_newversion(db, &version); if (result != ISC_R_SUCCESS) {