summaryrefslogtreecommitdiff
path: root/source4/librpc/rpc
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-09-27 08:41:39 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:59:21 -0500
commitaa12305945df5f1578250b56ae2f3653b051736f (patch)
tree30e072fca46873f0d59d736d65b96096326eec2a /source4/librpc/rpc
parent3aa3428bc93e6c8741b52eaa65d43f3a5abcee2e (diff)
downloadsamba-aa12305945df5f1578250b56ae2f3653b051736f.tar.gz
samba-aa12305945df5f1578250b56ae2f3653b051736f.tar.bz2
samba-aa12305945df5f1578250b56ae2f3653b051736f.zip
r2680: switched the libcli/raw/ code over to use talloc_reference(), which simplifies things quite a bit
(This used to be commit c82a9cf750829c4f6982ca3133295c8599023c4e)
Diffstat (limited to 'source4/librpc/rpc')
-rw-r--r--source4/librpc/rpc/dcerpc_smb.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/source4/librpc/rpc/dcerpc_smb.c b/source4/librpc/rpc/dcerpc_smb.c
index 7000bcd20d..893093c050 100644
--- a/source4/librpc/rpc/dcerpc_smb.c
+++ b/source4/librpc/rpc/dcerpc_smb.c
@@ -334,7 +334,7 @@ static NTSTATUS smb_shutdown_pipe(struct dcerpc_pipe *p)
c.close.in.fnum = smb->fnum;
c.close.in.write_time = 0;
smb_raw_close(smb->tree, &c);
- talloc_free(smb->tree);
+ talloc_free(smb);
return NT_STATUS_OK;
}
@@ -371,15 +371,14 @@ NTSTATUS dcerpc_pipe_open_smb(struct dcerpc_pipe **p,
{
struct smb_private *smb;
NTSTATUS status;
- char *name = NULL;
+ char *name;
union smb_open io;
- TALLOC_CTX *mem_ctx;
- asprintf(&name, "\\%s", pipe_name);
+ name = talloc_asprintf(tree, "\\%s", pipe_name);
if (!name) {
return NT_STATUS_NO_MEMORY;
}
-
+
io.ntcreatex.level = RAW_OPEN_NTCREATEX;
io.ntcreatex.in.flags = 0;
io.ntcreatex.in.root_fid = 0;
@@ -400,14 +399,8 @@ NTSTATUS dcerpc_pipe_open_smb(struct dcerpc_pipe **p,
io.ntcreatex.in.security_flags = 0;
io.ntcreatex.in.fname = name;
- mem_ctx = talloc_init("torture_rpc_connection");
- if (!mem_ctx) {
- free(name);
- return NT_STATUS_NO_MEMORY;
- }
- status = smb_raw_open(tree, mem_ctx, &io);
- free(name);
- talloc_free(mem_ctx);
+ status = smb_raw_open(tree, name, &io);
+ talloc_free(name);
if (!NT_STATUS_IS_OK(status)) {
return status;
@@ -440,10 +433,9 @@ NTSTATUS dcerpc_pipe_open_smb(struct dcerpc_pipe **p,
}
smb->fnum = io.ntcreatex.out.fnum;
- smb->tree = tree;
+ smb->tree = talloc_reference(smb, tree);
(*p)->transport.private = smb;
- talloc_increase_ref_count(tree);
return NT_STATUS_OK;
}