From 595fd91c35f0d4c7a9e3864bc48226e9b50e0b4b Mon Sep 17 00:00:00 2001 From: brad Date: Fri, 16 Jan 2015 01:10:10 +0000 Subject: [PATCH] Merge in a commit from upstream.. - Fix bug#637: fix that nsd.db grows limitlessly, an off by one on one megabyte free chunks, created during AXFRs of large zones, that caused the one megabyte chunk to be leaked. ok sthen@ --- usr.sbin/nsd/udb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.sbin/nsd/udb.c b/usr.sbin/nsd/udb.c index 9b31fcfc310..49532516a99 100644 --- a/usr.sbin/nsd/udb.c +++ b/usr.sbin/nsd/udb.c @@ -1309,7 +1309,7 @@ udb_void udb_alloc_space(udb_alloc* alloc, size_t sz) return ret + sizeof(udb_chunk_d); /* ptr to data */ } /* see if we can subdivide a larger chunk */ - for(e2 = exp+1; e2 < UDB_ALLOC_CHUNKS_MAX; e2++) + for(e2 = exp+1; e2 <= UDB_ALLOC_CHUNKS_MAX; e2++) if(alloc->disk->free[e2-UDB_ALLOC_CHUNK_MINEXP]) { udb_void big, ret; /* udb_chunk_d */ alloc->udb->glob_data->dirty_alloc = udb_dirty_fl; @@ -1344,7 +1344,7 @@ have_free_for(udb_alloc* alloc, int exp) int e2; if(alloc->disk->free[exp-UDB_ALLOC_CHUNK_MINEXP]) return exp; - for(e2 = exp+1; e2 < UDB_ALLOC_CHUNKS_MAX; e2++) + for(e2 = exp+1; e2 <= UDB_ALLOC_CHUNKS_MAX; e2++) if(alloc->disk->free[e2-UDB_ALLOC_CHUNK_MINEXP]) { return e2; } -- 2.20.1