[SCM] Samba Shared Repository - branch master updated
Michael Adam
obnox at samba.org
Thu Oct 27 18:38:02 MDT 2011
The branch, master has been updated
via ac79427 s4:torture:smb2: avoid leaking tree connects up to the main function from the durable_open test
via daf7193 s4:torture:smb2: fix a nasty double free error.
via 52b87f6 s4:torture:smb2: fix a comment
via b343a60 s4:torture:smb2: be leass leaky in wrap_simple_2smb2_test()
from a29f7e6 s3-ctdb: Fix ctdb_read_req
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit ac79427aa003542984769091188bd40059759cc9
Author: Michael Adam <obnox at samba.org>
Date: Fri Oct 28 00:11:08 2011 +0200
s4:torture:smb2: avoid leaking tree connects up to the main function from the durable_open test
The tree connects are handed in from the calling wrapper.
Those that are freed and reconnected inside the test function
can not be freed in the wrapper and stick to the torture_context
until this is released in the main function.
Autobuild-User: Michael Adam <obnox at samba.org>
Autobuild-Date: Fri Oct 28 02:37:25 CEST 2011 on sn-devel-104
commit daf7193c1d04f9a40c26a609e9bacad7f61d63b5
Author: Michael Adam <obnox at samba.org>
Date: Fri Oct 28 00:05:44 2011 +0200
s4:torture:smb2: fix a nasty double free error.
This error manifested itself in sporadic "talloc_free with references" error.
commit 52b87f63e2f98533c72aef264e066b703e9f0032
Author: Michael Adam <obnox at samba.org>
Date: Thu Oct 27 13:06:32 2011 +0200
s4:torture:smb2: fix a comment
commit b343a60ad71a3a6427e62e9f3763e4762fa98544
Author: Michael Adam <obnox at samba.org>
Date: Wed Oct 26 22:48:29 2011 +0200
s4:torture:smb2: be leass leaky in wrap_simple_2smb2_test()
-----------------------------------------------------------------------
Summary of changes:
source4/torture/smb2/durable_open.c | 13 +++++++++++++
source4/torture/smb2/smb2.c | 27 ++++++++++++++++++++-------
2 files changed, 33 insertions(+), 7 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source4/torture/smb2/durable_open.c b/source4/torture/smb2/durable_open.c
index 7a85443..544f404 100644
--- a/source4/torture/smb2/durable_open.c
+++ b/source4/torture/smb2/durable_open.c
@@ -164,6 +164,9 @@ bool test_durable_open_file_position(struct torture_context *tctx,
smb2_util_unlink(tree2, fname);
done:
+ talloc_free(tree1);
+ talloc_free(tree2);
+
return ret;
}
@@ -249,6 +252,9 @@ bool test_durable_open_oplock(struct torture_context *tctx,
smb2_util_close(tree2, h2);
smb2_util_unlink(tree2, fname);
+ talloc_free(tree1);
+ talloc_free(tree2);
+
return ret;
}
@@ -362,6 +368,9 @@ bool test_durable_open_lease(struct torture_context *tctx,
smb2_util_close(tree2, h2);
smb2_util_unlink(tree2, fname);
+ talloc_free(tree1);
+ talloc_free(tree2);
+
return ret;
}
@@ -469,6 +478,7 @@ bool test_durable_open_lock(struct torture_context *tctx,
done:
smb2_util_close(tree, h);
smb2_util_unlink(tree, fname);
+ talloc_free(tree);
return ret;
}
@@ -580,6 +590,9 @@ bool test_durable_open_open(struct torture_context *tctx,
smb2_util_close(tree1, h1);
smb2_util_unlink(tree1, fname);
+ talloc_free(tree1);
+ talloc_free(tree2);
+
return ret;
}
diff --git a/source4/torture/smb2/smb2.c b/source4/torture/smb2/smb2.c
index de8d400..3bbad29 100644
--- a/source4/torture/smb2/smb2.c
+++ b/source4/torture/smb2/smb2.c
@@ -30,17 +30,25 @@ static bool wrap_simple_1smb2_test(struct torture_context *torture_ctx,
{
bool (*fn) (struct torture_context *, struct smb2_tree *);
bool ret;
-
struct smb2_tree *tree1;
+ TALLOC_CTX *mem_ctx = talloc_new(torture_ctx);
if (!torture_smb2_connection(torture_ctx, &tree1))
return false;
+ /*
+ * This is a trick:
+ * The test might close the connection. If we steal the tree context
+ * before that and free the parent instead of tree directly, we avoid
+ * a double free error.
+ */
+ talloc_steal(mem_ctx, tree1);
+
fn = test->fn;
ret = fn(torture_ctx, tree1);
- talloc_free(tree1);
+ talloc_free(mem_ctx);
return ret;
}
@@ -74,25 +82,30 @@ 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);
- /* the test may already closed some of the connections */
+done:
+ /* the test may already have closed some of the connections */
talloc_free(mem_ctx);
return ret;
--
Samba Shared Repository
More information about the samba-cvs
mailing list