summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2013-08-08 19:16:26 +0200
committerAndrew Bartlett <abartlet@samba.org>2013-08-12 16:48:54 +1200
commit82e969b3c77fa62561c3ecbae2e3d0183e94b3e4 (patch)
treeb804e952d75a0eb60d6822bf2f90a9bdbabeb2b7
parent6b9977916ec6de2ae4b224e3dcbc6c1f3e7b207e (diff)
downloadsamba-82e969b3c77fa62561c3ecbae2e3d0183e94b3e4.tar.gz
samba-82e969b3c77fa62561c3ecbae2e3d0183e94b3e4.tar.bz2
samba-82e969b3c77fa62561c3ecbae2e3d0183e94b3e4.zip
s4:wrepl_out_helpers.c: avoid talloc_reference() in most cases
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r--source4/wrepl_server/wrepl_out_helpers.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/source4/wrepl_server/wrepl_out_helpers.c b/source4/wrepl_server/wrepl_out_helpers.c
index 660e1badb7..782e2f2908 100644
--- a/source4/wrepl_server/wrepl_out_helpers.c
+++ b/source4/wrepl_server/wrepl_out_helpers.c
@@ -357,8 +357,23 @@ static struct composite_context *wreplsrv_pull_table_send(TALLOC_CTX *mem_ctx, s
c->private_data = state;
if (io->in.num_owners) {
+ struct wrepl_wins_owner *partners;
+ uint32_t i;
+
+ partners = talloc_array(state,
+ struct wrepl_wins_owner,
+ io->in.num_owners);
+ if (composite_nomem(partners, c)) goto failed;
+
+ for (i=0; i < io->in.num_owners; i++) {
+ partners[i] = io->in.owners[i];
+ partners[i].address = talloc_strdup(partners,
+ io->in.owners[i].address);
+ if (composite_nomem(partners[i].address, c)) goto failed;
+ }
+
state->table_io.out.num_partners = io->in.num_owners;
- state->table_io.out.partners = io->in.owners;
+ state->table_io.out.partners = partners;
state->stage = WREPLSRV_PULL_TABLE_STAGE_DONE;
composite_done(c);
return c;
@@ -388,7 +403,7 @@ static NTSTATUS wreplsrv_pull_table_recv(struct composite_context *c, TALLOC_CTX
struct wreplsrv_pull_table_state *state = talloc_get_type(c->private_data,
struct wreplsrv_pull_table_state);
io->out.num_owners = state->table_io.out.num_partners;
- io->out.owners = talloc_reference(mem_ctx, state->table_io.out.partners);
+ io->out.owners = talloc_move(mem_ctx, &state->table_io.out.partners);
}
talloc_free(c);
@@ -548,7 +563,7 @@ static NTSTATUS wreplsrv_pull_names_recv(struct composite_context *c, TALLOC_CTX
struct wreplsrv_pull_names_state *state = talloc_get_type(c->private_data,
struct wreplsrv_pull_names_state);
io->out.num_names = state->pull_io.out.num_names;
- io->out.names = talloc_reference(mem_ctx, state->pull_io.out.names);
+ io->out.names = talloc_move(mem_ctx, &state->pull_io.out.names);
}
talloc_free(c);