mirror of
https://github.com/samba-team/samba.git
synced 2025-01-08 21:18:16 +03:00
pidl: set the per-request memory context in the pidl generator
The talloc memory context referenced by the pipe_struct mem_ctx member is used
as talloc parent for RPC response data by the RPC service implementations.
In Samba versions up to 4.10 all talloc children of p->mem_ctx were freed after
a RPC response was delivered by calling talloc_free_children(p->mem_ctx). Commit
60fa8e2552
removed this call which resulted in all
memory allocations on this context not getting released, which can consume
significant memory in long running RPC connections.
Instead of putting the talloc_free_children(p->mem_ctx) back, just use the
mem_ctx argument of the ${pipename}_op_dispatch_internal() function which is a
dcesrv_call_state object created by dcesrv_process_ncacn_packet() and released
by the RPC server when the RPC request processing is finished.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14675
CI: https://gitlab.com/samba-team/samba/-/merge_requests/1861
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
This commit is contained in:
parent
10d753868e
commit
4c3fb2a591
@ -299,6 +299,7 @@ sub boilerplate_iface($)
|
||||
$self->pidl("/* Update pipes struct opnum */");
|
||||
$self->pidl("p->opnum = opnum;");
|
||||
$self->pidl("p->dce_call = dce_call;");
|
||||
$self->pidl("p->mem_ctx = mem_ctx;");
|
||||
$self->pidl("/* Update pipes struct session info */");
|
||||
$self->pidl("pipe_session_info = p->session_info;");
|
||||
$self->pidl("p->session_info = dce_call->auth_state->session_info;");
|
||||
@ -344,6 +345,7 @@ sub boilerplate_iface($)
|
||||
$self->pidl("");
|
||||
|
||||
$self->pidl("p->dce_call = NULL;");
|
||||
$self->pidl("p->mem_ctx = NULL;");
|
||||
$self->pidl("/* Restore session info */");
|
||||
$self->pidl("p->session_info = pipe_session_info;");
|
||||
$self->pidl("p->auth.auth_type = 0;");
|
||||
|
@ -60,12 +60,6 @@ int make_base_pipes_struct(TALLOC_CTX *mem_ctx,
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
p->mem_ctx = talloc_named(p, 0, "pipe %s %p", pipe_name, p);
|
||||
if (!p->mem_ctx) {
|
||||
talloc_free(p);
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
p->msg_ctx = msg_ctx;
|
||||
p->transport = transport;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user