/* id is still in the buffer, no need to touch it */
reply_info_answer((struct reply_info*)e->data,
ldns_buffer_read_u16_at(c->buffer, 2), c->buffer);
+ lock_rw_unlock(&e->lock);
return 1;
}
ldns_buffer_rewind(c->buffer);
}
memmove(m->qname, q, m->qnamesize);
- if(ldns_buffer_remaining(query) < 4)
+ if(ldns_buffer_remaining(query) < 4) {
+ free(m->qname);
+ m->qname = NULL;
return 0; /* need qtype, qclass */
+ }
m->qtype = ldns_buffer_read_u16(query);
m->qclass = ldns_buffer_read_u16(query);
return 1;
e->entry.key = e;
e->entry.data = r;
lock_rw_init(&e->entry.lock);
- lock_protect(&e->entry.lock, e, sizeof(*e));
+ lock_protect(&e->entry.lock, &e->key, sizeof(e->key));
+ lock_protect(&e->entry.lock, &e->entry.hash, sizeof(e->entry.hash) +
+ sizeof(e->entry.key) + sizeof(e->entry.data));
lock_protect(&e->entry.lock, e->key.qname, e->key.qnamesize);
q->qname = NULL;
return e;