summaryrefslogtreecommitdiff
path: root/source4/rpc_server
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-08-21 01:54:46 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:58:14 -0500
commitb83ba93eaeb2dcb0bf11615591d886fda84e4162 (patch)
treeb2fe3c5a6ea7a9bd1f5f416e545ee26d4a207ac5 /source4/rpc_server
parent326f562e72c0776f469a8af93e25a2cc94dff60e (diff)
downloadsamba-b83ba93eaeb2dcb0bf11615591d886fda84e4162.tar.gz
samba-b83ba93eaeb2dcb0bf11615591d886fda84e4162.tar.bz2
samba-b83ba93eaeb2dcb0bf11615591d886fda84e4162.zip
r1983: a completely new implementation of talloc
This version does the following: 1) talloc_free(), talloc_realloc() and talloc_steal() lose their (redundent) first arguments 2) you can use _any_ talloc pointer as a talloc context to allocate more memory. This allows you to create complex data structures where the top level structure is the logical parent of the next level down, and those are the parents of the level below that. Then destroy either the lot with a single talloc_free() or destroy any sub-part with a talloc_free() of that part 3) you can name any pointer. Use talloc_named() which is just like talloc() but takes the printf style name argument as well as the parent context and the size. The whole thing ends up being a very simple piece of code, although some of the pointer walking gets hairy. So far, I'm just using the new talloc() like the old one. The next step is to actually take advantage of the new interface properly. Expect some new commits soon that simplify some common coding styles in samba4 by using the new talloc(). (This used to be commit e35bb094c52e550b3105dd1638d8d90de71d854f)
Diffstat (limited to 'source4/rpc_server')
-rw-r--r--source4/rpc_server/dcerpc_server.c9
-rw-r--r--source4/rpc_server/epmapper/rpc_epmapper.c2
-rw-r--r--source4/rpc_server/netlogon/dcerpc_netlogon.c4
-rw-r--r--source4/rpc_server/samr/dcesrv_samr.c8
4 files changed, 11 insertions, 12 deletions
diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c
index f83916f3c9..ab61ba3911 100644
--- a/source4/rpc_server/dcerpc_server.c
+++ b/source4/rpc_server/dcerpc_server.c
@@ -734,7 +734,7 @@ NTSTATUS dcesrv_input_process(struct dcesrv_connection *dce_conn)
}
call = talloc_p(mem_ctx, struct dcesrv_call_state);
if (!call) {
- talloc_free(dce_conn->mem_ctx, dce_conn->partial_input.data);
+ talloc_free(dce_conn->partial_input.data);
talloc_destroy(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
@@ -747,7 +747,7 @@ NTSTATUS dcesrv_input_process(struct dcesrv_connection *dce_conn)
ndr = ndr_pull_init_blob(&blob, mem_ctx);
if (!ndr) {
- talloc_free(dce_conn->mem_ctx, dce_conn->partial_input.data);
+ talloc_free(dce_conn->partial_input.data);
talloc_destroy(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
@@ -758,7 +758,7 @@ NTSTATUS dcesrv_input_process(struct dcesrv_connection *dce_conn)
status = ndr_pull_dcerpc_packet(ndr, NDR_SCALARS|NDR_BUFFERS, &call->pkt);
if (!NT_STATUS_IS_OK(status)) {
- talloc_free(dce_conn->mem_ctx, dce_conn->partial_input.data);
+ talloc_free(dce_conn->partial_input.data);
talloc_destroy(mem_ctx);
return status;
}
@@ -801,8 +801,7 @@ NTSTATUS dcesrv_input_process(struct dcesrv_connection *dce_conn)
}
call->pkt.u.request.stub_and_verifier.data =
- talloc_realloc(call->mem_ctx,
- call->pkt.u.request.stub_and_verifier.data, alloc_size);
+ talloc_realloc(call->pkt.u.request.stub_and_verifier.data, alloc_size);
if (!call->pkt.u.request.stub_and_verifier.data) {
return dcesrv_fault(call2, DCERPC_FAULT_OTHER);
}
diff --git a/source4/rpc_server/epmapper/rpc_epmapper.c b/source4/rpc_server/epmapper/rpc_epmapper.c
index f2c7b78335..62c545cd94 100644
--- a/source4/rpc_server/epmapper/rpc_epmapper.c
+++ b/source4/rpc_server/epmapper/rpc_epmapper.c
@@ -129,7 +129,7 @@ static uint32_t build_ep_list(TALLOC_CTX *mem_ctx,
struct dcesrv_if_list *iface;
for (iface=d->interface_list;iface;iface=iface->next) {
- (*eps) = talloc_realloc_p(mem_ctx, *eps,
+ (*eps) = talloc_realloc_p(*eps,
struct dcesrv_ep_iface,
total + 1);
if (!*eps) {
diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c b/source4/rpc_server/netlogon/dcerpc_netlogon.c
index a4ef06128c..d01c0c577b 100644
--- a/source4/rpc_server/netlogon/dcerpc_netlogon.c
+++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c
@@ -265,14 +265,14 @@ static NTSTATUS netr_ServerAuthenticate3(struct dcesrv_call_state *dce_call, TAL
if (pipe_state->account_name) {
/* We don't want a memory leak on this long-lived talloc context */
- talloc_free(pipe_state->mem_ctx, pipe_state->account_name);
+ talloc_free(pipe_state->account_name);
}
pipe_state->account_name = talloc_strdup(pipe_state->mem_ctx, r->in.account_name);
if (pipe_state->computer_name) {
/* We don't want a memory leak on this long-lived talloc context */
- talloc_free(pipe_state->mem_ctx, pipe_state->account_name);
+ talloc_free(pipe_state->account_name);
}
pipe_state->computer_name = talloc_strdup(pipe_state->mem_ctx, r->in.computer_name);
diff --git a/source4/rpc_server/samr/dcesrv_samr.c b/source4/rpc_server/samr/dcesrv_samr.c
index 4028a853d7..d670a2f8dc 100644
--- a/source4/rpc_server/samr/dcesrv_samr.c
+++ b/source4/rpc_server/samr/dcesrv_samr.c
@@ -572,7 +572,7 @@ static NTSTATUS samr_CreateDomainGroup(struct dcesrv_call_state *dce_call, TALLO
a_state->sam_ctx = d_state->sam_ctx;
a_state->access_mask = r->in.access_mask;
a_state->domain_state = d_state;
- a_state->account_dn = talloc_steal(mem_ctx, mem_ctx2, msg.dn);
+ a_state->account_dn = talloc_steal(mem_ctx2, msg.dn);
a_state->account_sid = talloc_strdup(mem_ctx2, sidstr);
a_state->account_name = talloc_strdup(mem_ctx2, groupname);
if (!a_state->account_name || !a_state->account_sid) {
@@ -756,7 +756,7 @@ static NTSTATUS samr_CreateUser2(struct dcesrv_call_state *dce_call, TALLOC_CTX
a_state->sam_ctx = d_state->sam_ctx;
a_state->access_mask = r->in.access_mask;
a_state->domain_state = d_state;
- a_state->account_dn = talloc_steal(mem_ctx, mem_ctx2, msg.dn);
+ a_state->account_dn = talloc_steal(mem_ctx2, msg.dn);
a_state->account_sid = talloc_strdup(mem_ctx2, sidstr);
a_state->account_name = talloc_strdup(mem_ctx2, account_name);
if (!a_state->account_name || !a_state->account_sid) {
@@ -1074,7 +1074,7 @@ static NTSTATUS samr_OpenGroup(struct dcesrv_call_state *dce_call, TALLOC_CTX *m
a_state->sam_ctx = d_state->sam_ctx;
a_state->access_mask = r->in.access_mask;
a_state->domain_state = d_state;
- a_state->account_dn = talloc_steal(mem_ctx, mem_ctx2, msgs[0]->dn);
+ a_state->account_dn = talloc_steal(mem_ctx2, msgs[0]->dn);
a_state->account_sid = talloc_strdup(mem_ctx2, sidstr);
a_state->account_name = talloc_strdup(mem_ctx2, groupname);
if (!a_state->account_name || !a_state->account_sid) {
@@ -1453,7 +1453,7 @@ static NTSTATUS samr_OpenUser(struct dcesrv_call_state *dce_call, TALLOC_CTX *me
a_state->sam_ctx = d_state->sam_ctx;
a_state->access_mask = r->in.access_mask;
a_state->domain_state = d_state;
- a_state->account_dn = talloc_steal(mem_ctx, mem_ctx2, msgs[0]->dn);
+ a_state->account_dn = talloc_steal(mem_ctx2, msgs[0]->dn);
a_state->account_sid = talloc_strdup(mem_ctx2, sidstr);
a_state->account_name = talloc_strdup(mem_ctx2, account_name);
if (!a_state->account_name || !a_state->account_sid) {