From: Wouter Wijngaards Date: Wed, 16 Sep 2009 12:47:56 +0000 (+0000) Subject: Memory leak fix. X-Git-Tag: release-1.4.0rc1~71 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=45acda0535f8da59568b6ac6846c2374b1f43e9f;p=thirdparty%2Funbound.git Memory leak fix. git-svn-id: file:///svn/unbound/trunk@1832 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/daemon/worker.c b/daemon/worker.c index 0d63ee2c6..3785831bf 100644 --- a/daemon/worker.c +++ b/daemon/worker.c @@ -806,6 +806,7 @@ worker_handle_request(struct comm_point* c, void* arg, int error, } if(local_zones_answer(worker->daemon->local_zones, &qinfo, &edns, c->buffer, worker->scratchpad)) { + regional_free_all(worker->scratchpad); if(ldns_buffer_limit(c->buffer) == 0) { comm_point_drop_reply(repinfo); return 0; diff --git a/doc/Changelog b/doc/Changelog index 33d84010c..e0069a9b6 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,6 @@ +16 September 2009: Wouter + - Fix memory leak reported by Tao Ma. + 15 September 2009: Wouter - iana portlist updated. diff --git a/libunbound/libworker.c b/libunbound/libworker.c index be0c5b47e..dcc093371 100644 --- a/libunbound/libworker.c +++ b/libunbound/libworker.c @@ -514,6 +514,7 @@ int libworker_fg(struct ub_ctx* ctx, struct ctx_query* q) ldns_buffer_write_u16_at(w->back->udp_buff, 2, qflags); if(local_zones_answer(ctx->local_zones, &qinfo, &edns, w->back->udp_buff, w->env->scratch)) { + regional_free_all(w->env->scratch); libworker_fillup_fg(q, LDNS_RCODE_NOERROR, w->back->udp_buff, sec_status_insecure); libworker_delete(w); @@ -630,6 +631,7 @@ handle_newq(struct libworker* w, uint8_t* buf, uint32_t len) ldns_buffer_write_u16_at(w->back->udp_buff, 2, qflags); if(local_zones_answer(w->ctx->local_zones, &qinfo, &edns, w->back->udp_buff, w->env->scratch)) { + regional_free_all(w->env->scratch); q->msg_security = sec_status_insecure; add_bg_result(w, q, w->back->udp_buff, UB_NOERROR); free(qinfo.qname);