qctx_freedata(query_ctx_t *qctx);
static void
-qctx_destroy(query_ctx_t *qctx);
+qctx_destroy(query_ctx_t **qctx);
+
+static void
+qctx_deinit(query_ctx_t *qctx);
static void
query_setup(ns_client_t *client, dns_rdatatype_t qtype);
cleanup:
qctx_freedata(&qctx);
- qctx_destroy(&qctx);
+ qctx_deinit(&qctx);
}
}
}
static void
-qctx_destroy(query_ctx_t *qctx) {
+qctx_destroy(query_ctx_t **qctxp) {
+ query_ctx_t *qctx = *qctxp;
+ *qctxp = NULL;
+
+ isc_mem_put(qctx->client->manager->mctx, qctx, sizeof(*qctx));
+}
+
+static void
+qctx_deinit(query_ctx_t *qctx) {
if (qctx->view) {
dns_view_detach(&qctx->view);
}
-
- if (qctx->allocated) {
- isc_mem_put(qctx->client->manager->mctx, qctx, sizeof(*qctx));
- }
}
/*
target->view = NULL;
dns_view_attach(src->view, &target->view);
- target->allocated = true;
-
*targetp = target;
}
(void)ns__query_start(&qctx);
cleanup:
- qctx_destroy(&qctx);
+ qctx_deinit(&qctx);
}
static bool
qctx_clean(qctx);
qctx_freedata(qctx);
- qctx_destroy(qctx);
+ qctx_deinit(qctx);
+ qctx_destroy(&qctx);
isc_nmhandle_detach(&handle);
}
}
}
- qctx_destroy(&qctx);
+ qctx_deinit(&qctx);
dns_resolver_destroyfetch(&fetch);
}
isc_mem_put(hctx->mctx, rev, sizeof(*rev));
hctx->destroy(&hctx);
- qctx_destroy(qctx);
+ qctx_deinit(qctx);
+ qctx_destroy(&qctx);
}
isc_result_t
if (saved_qctx != NULL) {
qctx_clean(saved_qctx);
qctx_freedata(saved_qctx);
- qctx_destroy(saved_qctx);
+ qctx_deinit(saved_qctx);
+ qctx_destroy(&saved_qctx);
}
return result;
}