mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-02-01 03:09:28 -05:00
fixup memory leak.
git-svn-id: file:///svn/unbound/trunk@426 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
3d9ea4721a
commit
5a66104adb
3 changed files with 10 additions and 3 deletions
|
|
@ -1,5 +1,7 @@
|
|||
27 June 2007: Wouter
|
||||
- delete of mesh does a postorder traverse of the tree.
|
||||
- found and fixed a memory leak. For TTL=0 messages, that would
|
||||
not be cached, instead the msg-replyinfo structure was leaked.
|
||||
|
||||
26 June 2007: Wouter
|
||||
- mesh is called by worker, and iterator uses it.
|
||||
|
|
|
|||
|
|
@ -317,8 +317,10 @@ iter_dns_store(struct module_env* env, struct dns_msg* msg, int is_referral)
|
|||
|
||||
qinf = msg->qinfo;
|
||||
qinf.qname = memdup(msg->qinfo.qname, msg->qinfo.qname_len);
|
||||
if(!qinf.qname)
|
||||
if(!qinf.qname) {
|
||||
reply_info_parsedelete(msg->rep, env->alloc);
|
||||
return 0;
|
||||
}
|
||||
/* fixup flags to be sensible for a reply based on the cache */
|
||||
/* this module means that RA is available. It is an answer QR.
|
||||
* Not AA from cache. Not CD in cache (depends on client bit). */
|
||||
|
|
@ -326,6 +328,8 @@ iter_dns_store(struct module_env* env, struct dns_msg* msg, int is_referral)
|
|||
rep->flags &= ~(BIT_AA | BIT_CD);
|
||||
h = query_info_hash(&qinf);
|
||||
dns_cache_store_msg(env, &qinf, h, rep);
|
||||
/* qname is used inside query_info_entrysetup, and set to
|
||||
* NULL. If it has not been used, free it. free(0) is safe. */
|
||||
free(qinf.qname);
|
||||
}
|
||||
return 1;
|
||||
|
|
|
|||
5
services/cache/dns.c
vendored
5
services/cache/dns.c
vendored
|
|
@ -78,8 +78,8 @@ dns_cache_store_msg(struct module_env* env, struct query_info* qinfo,
|
|||
|
||||
/* store RRsets */
|
||||
for(i=0; i<rep->rrset_count; i++) {
|
||||
rep->ref[i].key = rep->rrsets[i];
|
||||
rep->ref[i].id = rep->rrsets[i]->id;
|
||||
rep->ref[i].key = rep->rrsets[i];
|
||||
rep->ref[i].id = rep->rrsets[i]->id;
|
||||
}
|
||||
reply_info_sortref(rep);
|
||||
reply_info_set_ttls(rep, now);
|
||||
|
|
@ -88,6 +88,7 @@ dns_cache_store_msg(struct module_env* env, struct query_info* qinfo,
|
|||
/* we do not store the message, but we did store the RRs,
|
||||
* which could be useful for delegation information */
|
||||
verbose(VERB_ALGO, "TTL 0: dropped msg from cache");
|
||||
free(rep);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue