summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/internal.h4
-rw-r--r--src/query.c11
2 files changed, 15 insertions, 0 deletions
diff --git a/src/internal.h b/src/internal.h
index 7faa212..a537115 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -672,6 +672,10 @@ void adns__transfer_interim(adns_query from, adns_query to, void *block);
* TTLs get inherited by their parents.
*/
+void adns__free_interim(adns_query qu, void *p);
+/* Forget about a block allocated by adns__alloc_interim.
+ */
+
void *adns__alloc_mine(adns_query qu, size_t sz);
/* Like _interim, but does not record the length for later
* copying into the answer. This just ensures that the memory
diff --git a/src/query.c b/src/query.c
index c18ba8e..ebbfd53 100644
--- a/src/query.c
+++ b/src/query.c
@@ -415,6 +415,17 @@ static allocnode *alloc_info(adns_query qu, void *p, size_t *sz_r) {
return an;
}
+void adns__free_interim(adns_query qu, void *p) {
+ size_t sz;
+ allocnode *an= alloc_info(qu, p, &sz);
+
+ if (!an) return;
+ assert(!qu->final_allocspace);
+ LIST_UNLINK(qu->allocations, an);
+ free(an);
+ qu->interim_allocd -= sz;
+}
+
void *adns__alloc_mine(adns_query qu, size_t sz) {
return alloc_common(qu,MEM_ROUND(sz));
}