summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2012-12-17 17:46:34 +0100
committerGünther Deschner <gd@samba.org>2012-12-21 13:56:01 +0100
commitfd6041a22065613de6746d0058ac1ae42b84b3b7 (patch)
tree23127452804c2226815b5e6c0010496089a66efa
parent6168d95817ebcde746f6cf8fa4da937fff7d80b3 (diff)
downloadsamba-fd6041a22065613de6746d0058ac1ae42b84b3b7.tar.gz
samba-fd6041a22065613de6746d0058ac1ae42b84b3b7.tar.bz2
samba-fd6041a22065613de6746d0058ac1ae42b84b3b7.zip
s3-rpc_server: Fix null pointer derefs in rpc_pipe_open_interface().
Found by Coverity and asn ;) Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Günther Deschner <gd@samba.org>
-rw-r--r--source3/rpc_server/rpc_ncacn_np.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/source3/rpc_server/rpc_ncacn_np.c b/source3/rpc_server/rpc_ncacn_np.c
index 25ad8570a2..b4602a91d5 100644
--- a/source3/rpc_server/rpc_ncacn_np.c
+++ b/source3/rpc_server/rpc_ncacn_np.c
@@ -770,10 +770,12 @@ NTSTATUS rpc_pipe_open_interface(TALLOC_CTX *mem_ctx,
NTSTATUS status;
TALLOC_CTX *tmp_ctx;
- if (cli_pipe && rpccli_is_connected(*cli_pipe)) {
- return NT_STATUS_OK;
- } else {
- TALLOC_FREE(*cli_pipe);
+ if (cli_pipe != NULL) {
+ if (rpccli_is_connected(*cli_pipe)) {
+ return NT_STATUS_OK;
+ } else {
+ TALLOC_FREE(*cli_pipe);
+ }
}
tmp_ctx = talloc_stackframe();
@@ -827,7 +829,7 @@ NTSTATUS rpc_pipe_open_interface(TALLOC_CTX *mem_ctx,
status = NT_STATUS_OK;
done:
- if (NT_STATUS_IS_OK(status)) {
+ if (NT_STATUS_IS_OK(status) && cli_pipe != NULL) {
*cli_pipe = talloc_move(mem_ctx, &cli);
}
TALLOC_FREE(tmp_ctx);