From 6385f750f19a00a6ba16a0aec9bb91ab1cfcb2be Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 13 Feb 2013 14:58:29 +0100 Subject: [PATCH] s4:torture:smb2: fix segfault on error condition in durable-open.reopen2 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 1afc1c16f94..c783fc310c2 100644 --- a/source4/torture/smb2/durable_open.c +++ b/source4/torture/smb2/durable_open.c @@ -466,13 +466,15 @@ static bool test_durable_open_reopen2(struct torture_context *tctx, h = &_h; done: - if (h != NULL) { - smb2_util_close(tree, *h); - } + if (tree != NULL) { + if (h != NULL) { + smb2_util_close(tree, *h); + } - smb2_util_unlink(tree, fname); + smb2_util_unlink(tree, fname); - talloc_free(tree); + talloc_free(tree); + } talloc_free(mem_ctx); -- 2.11.4.GIT