s4:torture:smb2: fix segfault on error condition in durable-open.reopen2 test
authorMichael Adam <obnox@samba.org>
Wed, 13 Feb 2013 13:58:29 +0000 (14:58 +0100)
committerStefan Metzmacher <metze@samba.org>
Mon, 18 Feb 2013 14:55:06 +0000 (15:55 +0100)
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source4/torture/smb2/durable_open.c

index 1afc1c16f9441668b549a0c25f4ce650de2aa25c..c783fc310c27aed46c2828b4d31c82137f025b48 100644 (file)
@@ -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);