s4:torture:smb2: fix segfault on error condition in the durable-open.reopen3 test
authorMichael Adam <obnox@samba.org>
Wed, 13 Feb 2013 14:01:47 +0000 (15:01 +0100)
committerStefan Metzmacher <metze@samba.org>
Mon, 18 Feb 2013 14:55:30 +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 ec63c5c3ce88683a9dd34477b2abef2e6264ec34..8a1e5c7e272fa7dd0f16792621c2a6febae385bc 100644 (file)
@@ -611,13 +611,15 @@ static bool test_durable_open_reopen3(struct torture_context *tctx,
        CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND);
 
 done:
-       if (h != NULL) {
-               smb2_util_close(tree, *h);
-       }
+       if (tree != NULL) {
+               if (h != NULL) {
+                       smb2_util_close(tree, *h);
+               }
 
-       smb2_util_unlink(tree2, fname);
+               smb2_util_unlink(tree2, fname);
 
-       talloc_free(tree);
+               talloc_free(tree);
+       }
 
        talloc_free(mem_ctx);