From: Michael Adam Date: Wed, 13 Feb 2013 14:00:26 +0000 (+0100) Subject: s4:torture:smb2: fix segfault on error condition in the durable-open.reopen2a test X-Git-Tag: tevent-0.9.18~223 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cb9b8975e5a9c032f7c4227c3eafb1ed6ada5e19;p=thirdparty%2Fsamba.git s4:torture:smb2: fix segfault on error condition in the durable-open.reopen2a test Signed-off-by: Michael Adam Reviewed-by: Stefan Metzmacher --- diff --git a/source4/torture/smb2/durable_open.c b/source4/torture/smb2/durable_open.c index c783fc310c2..ec63c5c3ce8 100644 --- a/source4/torture/smb2/durable_open.c +++ b/source4/torture/smb2/durable_open.c @@ -541,13 +541,15 @@ static bool test_durable_open_reopen2a(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);