summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_client/cli_pipe.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
index 6bd240dd81..9908c69674 100644
--- a/source3/rpc_client/cli_pipe.c
+++ b/source3/rpc_client/cli_pipe.c
@@ -2503,6 +2503,12 @@ NTSTATUS rpccli_kerberos_bind_data(TALLOC_CTX *mem_ctx,
#endif
}
+static int rpc_pipe_sock_destructor(struct rpc_pipe_client *p)
+{
+ close(p->trans.sock.fd);
+ return 0;
+}
+
/********************************************************************
Create a rpc pipe client struct, connecting to a tcp port
********************************************************************/
@@ -2547,6 +2553,8 @@ NTSTATUS rpc_pipe_open_tcp(TALLOC_CTX *mem_ctx, const char *host,
goto fail;
}
+ talloc_set_destructor(result, rpc_pipe_sock_destructor);
+
*presult = result;
return NT_STATUS_OK;
@@ -2593,6 +2601,8 @@ NTSTATUS rpc_pipe_open_ncalrpc(TALLOC_CTX *mem_ctx, const char *socket_path,
goto fail;
}
+ talloc_set_destructor(result, rpc_pipe_sock_destructor);
+
result->dc = TALLOC_ZERO_P(result, struct dcinfo);
if (result->dc == NULL) {
status = NT_STATUS_NO_MEMORY;