summaryrefslogtreecommitdiff
path: root/bin/named/lwdgrbn.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/named/lwdgrbn.c')
-rw-r--r--bin/named/lwdgrbn.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/bin/named/lwdgrbn.c b/bin/named/lwdgrbn.c
index 5c858cbe..3e7b15bb 100644
--- a/bin/named/lwdgrbn.c
+++ b/bin/named/lwdgrbn.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004-2007, 2009 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2007, 2009, 2013, 2014 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000, 2001, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -124,8 +124,8 @@ iterate_node(lwres_grbnresponse_t *grbn, dns_db_t *db, dns_dbnode_t *node,
lens = isc_mem_get(mctx, size * sizeof(*lens));
if (lens == NULL)
goto out;
- memcpy(rdatas, oldrdatas, used * sizeof(*rdatas));
- memcpy(lens, oldlens, used * sizeof(*lens));
+ memmove(rdatas, oldrdatas, used * sizeof(*rdatas));
+ memmove(lens, oldlens, used * sizeof(*lens));
isc_mem_put(mctx, oldrdatas,
oldsize * sizeof(*oldrdatas));
isc_mem_put(mctx, oldlens, oldsize * sizeof(*oldlens));
@@ -158,8 +158,8 @@ iterate_node(lwres_grbnresponse_t *grbn, dns_db_t *db, dns_dbnode_t *node,
newlens = isc_mem_get(mctx, used * sizeof(*lens));
if (newlens == NULL)
goto out;
- memcpy(newrdatas, rdatas, used * sizeof(*rdatas));
- memcpy(newlens, lens, used * sizeof(*lens));
+ memmove(newrdatas, rdatas, used * sizeof(*rdatas));
+ memmove(newlens, lens, used * sizeof(*lens));
isc_mem_put(mctx, rdatas, size * sizeof(*rdatas));
isc_mem_put(mctx, lens, size * sizeof(*lens));
grbn->rdatas = newrdatas;
@@ -204,6 +204,8 @@ lookup_done(isc_task_t *task, isc_event_t *event) {
lwres_grbnresponse_t *grbn;
int i;
+ REQUIRE(event != NULL);
+
UNUSED(task);
lwb.base = NULL;
@@ -324,9 +326,6 @@ lookup_done(isc_task_t *task, isc_event_t *event) {
(grbn->nsigs == 1) ? "" : "s");
}
- dns_lookup_destroy(&client->lookup);
- isc_event_free(&event);
-
/*
* Render the packet.
*/
@@ -362,6 +361,9 @@ lookup_done(isc_task_t *task, isc_event_t *event) {
NS_LWDCLIENT_SETSEND(client);
+ dns_lookup_destroy(&client->lookup);
+ isc_event_free(&event);
+
return;
out:
@@ -384,8 +386,7 @@ lookup_done(isc_task_t *task, isc_event_t *event) {
if (lwb.base != NULL)
lwres_context_freemem(cm->lwctx, lwb.base, lwb.length);
- if (event != NULL)
- isc_event_free(&event);
+ isc_event_free(&event);
ns_lwdclient_log(50, "error constructing getrrsetbyname response");
ns_lwdclient_errorpktsend(client, LWRES_R_FAILURE);