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.
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). */
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;
/* 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);
/* 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;
}