/** Internal request (i.e. one generated by the interpreter) is now complete
*
- * Whatever generated the request is now responsible for freeing it.
+ * Whatever generated the request is now responsible for freeing it,
+ * unless there's no talloc parent. In which case we have to free it.
*/
static void _worker_request_done_internal(request_t *request, UNUSED rlm_rcode_t rcode, void *uctx)
{
fr_assert(!fr_heap_entry_inserted(request->runnable_id));
fr_assert(!fr_minmax_heap_entry_inserted(request->time_order_id));
+
+ if (!talloc_parent(request)) talloc_free(request);
}
/** Detached request (i.e. one generated by the interpreter with no parent) is now complete
* shutting down.
*/
unlang_interpret_synchronous(NULL, request);
- talloc_free(request);
}
/*
- * Otherwise the worker cleans up the request request.
+ * Otherwise the worker cleans up the request.
*/
return 0;
}
/** Internal request (i.e. one generated by the interpreter) is now complete
*
+ * Whatever generated the request is now responsible for freeing it,
+ * unless there's no talloc parent. In which case we have to free it.
*/
static void _request_done_internal(request_t *request, UNUSED rlm_rcode_t rcode, UNUSED void *uctx)
{
RDEBUG3("Done synchronous internal request");
- /* Request will be cleaned up by whatever created it */
+ if (!talloc_parent(request)) talloc_free(request);
}
static void _request_done_detached(request_t *request, UNUSED rlm_rcode_t rcode, UNUSED void *uctx)