fixup libunbound message buffer.

git-svn-id: file:///svn/unbound/trunk@1412 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2009-01-06 17:50:56 +00:00
parent c1ae463da5
commit 6e9d214816
2 changed files with 10 additions and 5 deletions

View file

@ -11,6 +11,7 @@
- fix reading included config files when chrooted.
Give full path names for include files.
Relative path names work if the start dir equals the working dir.
- fix libunbound message transport when no packet buffer is available.
5 January 2009: Wouter
- fixup getaddrinfo failure handling for remote control port.

View file

@ -539,11 +539,15 @@ add_bg_result(struct libworker* w, struct ctx_query* q, ldns_buffer* pkt,
/* serialize and delete unneeded q */
if(w->is_bg_thread) {
lock_basic_lock(&w->ctx->cfglock);
q->msg_len = ldns_buffer_remaining(pkt);
q->msg = memdup(ldns_buffer_begin(pkt), q->msg_len);
if(!q->msg)
msg = context_serialize_answer(q, UB_NOMEM, NULL, &len);
else msg = context_serialize_answer(q, err, NULL, &len);
if(pkt) {
q->msg_len = ldns_buffer_remaining(pkt);
q->msg = memdup(ldns_buffer_begin(pkt), q->msg_len);
if(!q->msg)
msg = context_serialize_answer(q, UB_NOMEM,
NULL, &len);
else msg = context_serialize_answer(q, err,
NULL, &len);
} else msg = context_serialize_answer(q, err, NULL, &len);
lock_basic_unlock(&w->ctx->cfglock);
} else {
msg = context_serialize_answer(q, err, pkt, &len);