s4:torture:smb2: fix segfault on error condition in the durable-open.reopen4 test
authorMichael Adam <obnox@samba.org>
Wed, 13 Feb 2013 14:03:00 +0000 (15:03 +0100)
committerStefan Metzmacher <metze@samba.org>
Mon, 18 Feb 2013 14:55:41 +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 8a1e5c7e272fa7dd0f16792621c2a6febae385bc..df67d77e57c66e43527505361a269b57a6e891e1 100644 (file)
@@ -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);