*/
while (xlat_inst_tree && (xi = fr_heap_pop(&xlat_inst_tree))) talloc_free(xi);
}
+
+/** Remove a node from the list of xlat instance data
+ *
+ */
+int xlat_inst_remove(xlat_exp_t *node)
+{
+ int ret;
+
+ fr_assert(node->type == XLAT_FUNC);
+ fr_assert(!node->call.func->detach);
+ fr_assert(!node->call.func->thread_detach);
+
+ if (node->call.inst) {
+ ret = fr_heap_extract(&xlat_inst_tree, node->call.inst);
+ if (ret < 0) return ret;
+
+ talloc_set_destructor(node->call.inst, NULL);
+ TALLOC_FREE(node->call.inst);
+ }
+
+ if (node->call.thread_inst) {
+ if (!node->call.ephemeral) {
+ ret = fr_heap_extract(&xlat_thread_inst_tree, node->call.thread_inst);
+ if (ret < 0) return ret;
+ }
+
+ talloc_set_destructor(node->call.thread_inst, NULL);
+ TALLOC_FREE(node->call.inst);
+ }
+
+
+ node->type = XLAT_INVALID;
+ return 0;
+}
ssize_t xlat_print_node(fr_sbuff_t *out, xlat_exp_head_t const *head, xlat_exp_t const *node, fr_sbuff_escape_rules_t const *e_rules);
+/*
+ * xlat_inst.c
+ */
+int xlat_inst_remove(xlat_exp_t *node);
+
static inline xlat_exp_t *xlat_exp_head(xlat_exp_head_t const *head)
{
if (!head) return NULL;
if (!success) return -1;
/*
- * The function call becomes a GROUP of
- * boxes. We just re-use the argument head, which is already of the type we need.
+ * The function call becomes a GROUP of boxes. We just re-use the argument head,
+ * which is already of the type we need.
*/
group = node->call.args;
fr_dlist_talloc_free(&group->dlist);
+
+ xlat_inst_remove(node);
node->type = XLAT_GROUP;
node->group = group;