From 6deec81b8e89e7a525925952159cbb45e5d28647 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 23 Feb 2012 23:43:18 +0100 Subject: [PATCH] s4:torture:smb2:durable-open: introduce new variable for the new session This is to clarify the code. --- source4/torture/smb2/durable_open.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/source4/torture/smb2/durable_open.c b/source4/torture/smb2/durable_open.c index d0f7c4e52d5..22c01760258 100644 --- a/source4/torture/smb2/durable_open.c +++ b/source4/torture/smb2/durable_open.c @@ -529,6 +529,7 @@ bool test_durable_open_reopen4(struct torture_context *tctx, struct smb2_create io1, io2; bool ret = true; struct smb2_transport *transport; + struct smb2_session *session2; struct smb2_tree *tree2; /* Choose a random name in case the state is left a little funky. */ @@ -559,12 +560,18 @@ bool test_durable_open_reopen4(struct torture_context *tctx, status = smb2_logoff(tree->session); CHECK_STATUS(status, NT_STATUS_OK); - if (!torture_smb2_session_setup(tctx, transport, mem_ctx, &tree->session)) { + if (!torture_smb2_session_setup(tctx, transport, mem_ctx, &session2)) { torture_warning(tctx, "session setup failed.\n"); ret = false; goto done; } + /* + * the session setup has talloc-stolen the transport, + * so we can safely free the old tree+session for clarity + */ + TALLOC_FREE(tree); + ZERO_STRUCT(io2); io2.in.fname = fname; io2.in.durable_handle = h; @@ -572,7 +579,7 @@ bool test_durable_open_reopen4(struct torture_context *tctx, status = smb2_create(tree, mem_ctx, &io2); CHECK_STATUS(status, NT_STATUS_NETWORK_NAME_DELETED); - if (!torture_smb2_tree_connect(tctx, tree->session, mem_ctx, &tree2)) { + if (!torture_smb2_tree_connect(tctx, session2, mem_ctx, &tree2)) { torture_warning(tctx, "tree connect failed.\n"); ret = false; goto done; -- 2.11.4.GIT