summaryrefslogtreecommitdiff
path: root/source3/rpc_server/rpc_ncacn_np.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2010-09-15 11:38:53 +0200
committerAndreas Schneider <asn@samba.org>2010-09-15 12:53:43 +0200
commite580c6d88f4f124e06562fe56c1d9437d1205658 (patch)
tree6e4ce884a3b8ae790e65b7f747b4d9ddf7950d5b /source3/rpc_server/rpc_ncacn_np.c
parent8ec7aaef48c3d9a6b1f07602c5410b5524099d36 (diff)
downloadsamba-e580c6d88f4f124e06562fe56c1d9437d1205658.tar.gz
samba-e580c6d88f4f124e06562fe56c1d9437d1205658.tar.bz2
samba-e580c6d88f4f124e06562fe56c1d9437d1205658.zip
s3-rpc_server: Use talloc_stackframe.
Diffstat (limited to 'source3/rpc_server/rpc_ncacn_np.c')
-rw-r--r--source3/rpc_server/rpc_ncacn_np.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/source3/rpc_server/rpc_ncacn_np.c b/source3/rpc_server/rpc_ncacn_np.c
index 599567d71f..ea65e042ab 100644
--- a/source3/rpc_server/rpc_ncacn_np.c
+++ b/source3/rpc_server/rpc_ncacn_np.c
@@ -815,26 +815,27 @@ NTSTATUS rpc_pipe_open_interface(TALLOC_CTX *mem_ctx,
struct messaging_context *msg_ctx,
struct rpc_pipe_client **cli_pipe)
{
- TALLOC_CTX *tmpctx;
+ struct rpc_pipe_client *cli = NULL;
const char *server_type;
const char *pipe_name;
NTSTATUS status;
+ TALLOC_CTX *tmp_ctx;
- if (rpccli_is_connected(*cli_pipe)) {
+ if (cli_pipe && rpccli_is_connected(*cli_pipe)) {
return NT_STATUS_OK;
} else {
TALLOC_FREE(*cli_pipe);
}
- tmpctx = talloc_new(mem_ctx);
- if (!tmpctx) {
+ tmp_ctx = talloc_stackframe();
+ if (tmp_ctx == NULL) {
return NT_STATUS_NO_MEMORY;
}
- pipe_name = get_pipe_name_from_syntax(tmpctx, syntax);
- if (!pipe_name) {
- TALLOC_FREE(tmpctx);
- return NT_STATUS_INVALID_PARAMETER;
+ pipe_name = get_pipe_name_from_syntax(tmp_ctx, syntax);
+ if (pipe_name == NULL) {
+ status = NT_STATUS_INVALID_PARAMETER;
+ goto done;
}
DEBUG(10, ("Connecting to %s pipe.\n", pipe_name));
@@ -843,10 +844,10 @@ NTSTATUS rpc_pipe_open_interface(TALLOC_CTX *mem_ctx,
"rpc_server", pipe_name,
"embedded");
if (StrCaseCmp(server_type, "embedded") == 0) {
- status = rpc_pipe_open_internal(tmpctx,
+ status = rpc_pipe_open_internal(tmp_ctx,
syntax, server_info,
client_id, msg_ctx,
- cli_pipe);
+ &cli);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
@@ -855,10 +856,10 @@ NTSTATUS rpc_pipe_open_interface(TALLOC_CTX *mem_ctx,
* for now we need to use the special proxy setup to connect
* to spoolssd. */
- status = rpc_pipe_open_external(tmpctx,
+ status = rpc_pipe_open_external(tmp_ctx,
pipe_name, syntax,
server_info,
- cli_pipe);
+ &cli);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
@@ -867,8 +868,8 @@ NTSTATUS rpc_pipe_open_interface(TALLOC_CTX *mem_ctx,
status = NT_STATUS_OK;
done:
if (NT_STATUS_IS_OK(status)) {
- talloc_steal(mem_ctx, *cli_pipe);
+ *cli_pipe = talloc_move(mem_ctx, &cli);
}
- TALLOC_FREE(tmpctx);
+ TALLOC_FREE(tmp_ctx);
return status;
}