From bc658e036160e0fdea9baec5f5011964182cc920 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Fri, 10 Apr 2015 10:57:25 +0000 Subject: [PATCH] Fixes. git-svn-id: file:///svn/unbound/trunk@3392 be551aaa-1e26-0410-a405-d3ace91eadb9 --- doc/unbound.conf.5.in | 2 +- iterator/iterator.c | 3 ++- services/cache/infra.c | 10 ++++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/doc/unbound.conf.5.in b/doc/unbound.conf.5.in index d3346c940..c0e4c60bb 100644 --- a/doc/unbound.conf.5.in +++ b/doc/unbound.conf.5.in @@ -993,7 +993,7 @@ nameservers for those zones. .TP 5 .B ratelimit\-size: \fI Give the size of the data structure in which the current ongoing rates are -kep track in. Default 4m. In bytes or use m(mega), k(kilo), g(giga). +kept track in. Default 4m. In bytes or use m(mega), k(kilo), g(giga). The ratelimit structure is small, so this data structure likely does not need to be large. .TP 5 diff --git a/iterator/iterator.c b/iterator/iterator.c index 11312e16f..947255824 100644 --- a/iterator/iterator.c +++ b/iterator/iterator.c @@ -1954,7 +1954,8 @@ processQueryTargets(struct module_qstate* qstate, struct iter_qstate* iq, if(!outq) { log_addr(VERB_DETAIL, "error sending query to auth server", &target->addr, target->addrlen); - infra_ratelimit_dec(qstate->env->infra_cache, iq->dp->name, + if(!(iq->chase_flags & BIT_RD)) + infra_ratelimit_dec(qstate->env->infra_cache, iq->dp->name, iq->dp->namelen, *qstate->env->now); return next_state(iq, QUERYTARGETS_STATE); } diff --git a/services/cache/infra.c b/services/cache/infra.c index 2c8f2fa28..d80ea27e8 100644 --- a/services/cache/infra.c +++ b/services/cache/infra.c @@ -162,13 +162,17 @@ static struct domain_limit_data* domain_limit_findcreate( /* can we find it? */ d = (struct domain_limit_data*)name_tree_find(&infra->domain_limits, nm, nmlen, labs, LDNS_RR_CLASS_IN); - if(d) + if(d) { + free(nm); return d; + } /* create it */ d = (struct domain_limit_data*)calloc(1, sizeof(*d)); - if(!d) + if(!d) { + free(nm); return NULL; + } d->node.node.key = &d->node; d->node.name = nm; d->node.len = nmlen; @@ -179,6 +183,8 @@ static struct domain_limit_data* domain_limit_findcreate( if(!name_tree_insert(&infra->domain_limits, &d->node, nm, nmlen, labs, LDNS_RR_CLASS_IN)) { log_err("duplicate element in domainlimit tree"); + free(nm); + free(d); return NULL; } return d; -- 2.47.2