From 5c10f54fe38795cbd3d5cf22e3fbd1d22b8226e4 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Tue, 6 Aug 2002 14:33:08 +0000 Subject: [PATCH] 1355. [bug] It was possible to trigger a INSIST when debugging large dynamic updates. [RT #3390] --- CHANGES | 3 +++ lib/dns/diff.c | 43 ++++++++++++++++++++----------------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/CHANGES b/CHANGES index 4a69f350b4..b59b1609fc 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +1355. [bug] It was possible to trigger a INSIST when debugging + large dynamic updates. [RT #3390] + 1354. [bug] nsupdate was extremely wasteful of memory. 1355. [tuning] Reduce the number of events / quantum for zone tasks. diff --git a/lib/dns/diff.c b/lib/dns/diff.c index 76285d7efa..6cb4a6ad34 100644 --- a/lib/dns/diff.c +++ b/lib/dns/diff.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: diff.c,v 1.5 2001/11/29 00:15:34 gson Exp $ */ +/* $Id: diff.c,v 1.6 2002/08/06 14:33:08 marka Exp $ */ #include @@ -499,13 +499,6 @@ dns_diff_print(dns_diff_t *diff, FILE *file) { result = dns_rdataset_totext(&rds, &t->name, ISC_FALSE, ISC_FALSE, &buf); - /* - * Get rid of final newline. - */ - INSIST(buf.used >= 1 && - ((char *) buf.base)[buf.used-1] == '\n'); - buf.used--; - if (result == ISC_R_NOSPACE) { isc_mem_put(diff->mctx, mem, size); size += 1024; @@ -516,22 +509,26 @@ dns_diff_print(dns_diff_t *diff, FILE *file) { } goto again; } - if (result == ISC_R_SUCCESS) { - isc_buffer_usedregion(&buf, &r); - if (file != NULL) - fprintf(file, "%s %.*s\n", - t->op == DNS_DIFFOP_ADD ? - "add" : "del", (int) r.length, - (char *) r.base); - else - isc_log_write(DIFF_COMMON_LOGARGS, - ISC_LOG_DEBUG(7), - "%s %.*s", - t->op == DNS_DIFFOP_ADD ? - "add" : "del", - (int) r.length, (char *) r.base); - } else + + if (result != ISC_R_SUCCESS) goto cleanup; + /* + * Get rid of final newline. + */ + INSIST(buf.used >= 1 && + ((char *) buf.base)[buf.used-1] == '\n'); + buf.used--; + + isc_buffer_usedregion(&buf, &r); + if (file != NULL) + fprintf(file, "%s %.*s\n", + t->op == DNS_DIFFOP_ADD ? "add" : "del", + (int) r.length, (char *) r.base); + else + isc_log_write(DIFF_COMMON_LOGARGS, ISC_LOG_DEBUG(7), + "%s %.*s", + t->op == DNS_DIFFOP_ADD ? "add" : "del", + (int) r.length, (char *) r.base); } result = ISC_R_SUCCESS; cleanup: