s4:torture:smb2: be leass leaky in wrap_simple_2smb2_test()
authorMichael Adam <obnox@samba.org>
Wed, 26 Oct 2011 20:48:29 +0000 (22:48 +0200)
committerMichael Adam <obnox@samba.org>
Thu, 27 Oct 2011 23:00:00 +0000 (01:00 +0200)
source4/torture/smb2/smb2.c

index de8d400ff8b36b70805b4a98719619a7cdc06586..76c6e2446d2dc4e7c60d574824dc3d9c1bb835ac 100644 (file)
@@ -74,24 +74,29 @@ static bool wrap_simple_2smb2_test(struct torture_context *torture_ctx,
                                   struct torture_test *test)
 {
        bool (*fn) (struct torture_context *, struct smb2_tree *, struct smb2_tree *);
-       bool ret;
+       bool ret = false;
 
        struct smb2_tree *tree1;
        struct smb2_tree *tree2;
        TALLOC_CTX *mem_ctx = talloc_new(torture_ctx);
 
-       if (!torture_smb2_connection(torture_ctx, &tree1) ||
-           !torture_smb2_connection(torture_ctx, &tree2)) {
-               return false;
+       if (!torture_smb2_connection(torture_ctx, &tree1)) {
+               goto done;
        }
 
        talloc_steal(mem_ctx, tree1);
+
+       if (!torture_smb2_connection(torture_ctx, &tree2)) {
+               goto done;
+       }
+
        talloc_steal(mem_ctx, tree2);
 
        fn = test->fn;
 
        ret = fn(torture_ctx, tree1, tree2);
 
+done:
        /* the test may already closed some of the connections */
        talloc_free(mem_ctx);