From 98b0e909b7b65bee694743617476d4d36fe595a3 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 13 Feb 2013 15:03:00 +0100 Subject: [PATCH] s4:torture:smb2: fix segfault on error condition in the durable-open.reopen4 test Signed-off-by: Michael Adam Reviewed-by: Stefan Metzmacher --- source4/torture/smb2/durable_open.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/source4/torture/smb2/durable_open.c b/source4/torture/smb2/durable_open.c index 8a1e5c7e272..df67d77e57c 100644 --- a/source4/torture/smb2/durable_open.c +++ b/source4/torture/smb2/durable_open.c @@ -707,13 +707,15 @@ static bool test_durable_open_reopen4(struct torture_context *tctx, CHECK_VAL(io2.out.oplock_level, smb2_util_oplock_level("b")); done: - if (h != NULL) { - smb2_util_close(tree2, *h); - } + if (tree != NULL) { + if (h != NULL) { + smb2_util_close(tree2, *h); + } - smb2_util_unlink(tree2, fname); + smb2_util_unlink(tree2, fname); - talloc_free(tree); + talloc_free(tree); + } talloc_free(mem_ctx); -- 2.11.4.GIT