From: Stefan Metzmacher Date: Thu, 31 Aug 2006 09:26:43 +0000 (+0000) Subject: r17958: as talloc_init() enabled null tracking, we should avoid to use it X-Git-Tag: samba-4.0.0alpha6~801^3~5255 X-Git-Url: http://git.samba.org/samba.git/?p=gd%2Fsamba-autobuild%2F.git;a=commitdiff_plain;h=722d20f4ddef98ba8f305ea858c54e5df54ca27c r17958: as talloc_init() enabled null tracking, we should avoid to use it in smbtorture, and in the LOCAL-TALLOC we should reset the null tracking also make bin/smbtorture //url/foo LOCAL-TALLOC LOCAL-TALLOC possible metze (This used to be commit d1dd3df5e4fd21f5cbd00e472438fe3eadb266e5) --- diff --git a/source4/lib/talloc/testsuite.c b/source4/lib/talloc/testsuite.c index 013f01cc2cf..ca5e9042d34 100644 --- a/source4/lib/talloc/testsuite.c +++ b/source4/lib/talloc/testsuite.c @@ -910,6 +910,7 @@ static BOOL test_loop(void) printf("FAILED TO FIRE LOOP DESTRUCTOR\n"); return False; } + loop_destructor_count = 0; return True; } @@ -1021,6 +1022,7 @@ BOOL torture_local_talloc(struct torture_context *torture) { BOOL ret = True; + talloc_disable_null_tracking(); talloc_enable_null_tracking(); ret &= test_ref1(); diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c index 0ee60f8a182..b8dc2362eae 100644 --- a/source4/torture/gentest.c +++ b/source4/torture/gentest.c @@ -1970,7 +1970,7 @@ static int run_test(void) current_op.opnum = op; current_op.name = gen_ops[which_op].name; current_op.status = NT_STATUS_OK; - current_op.mem_ctx = talloc_init("%s", current_op.name); + current_op.mem_ctx = talloc_named(NULL, 0, "%s", current_op.name); ret = gen_ops[which_op].handler(instance); diff --git a/source4/torture/misc.c b/source4/torture/misc.c index f04b7782ebe..62b956337c9 100644 --- a/source4/torture/misc.c +++ b/source4/torture/misc.c @@ -395,7 +395,7 @@ static BOOL torture_ioctl_test(struct torture_context *torture) return False; } - mem_ctx = talloc_init("ioctl_test"); + mem_ctx = talloc_named_const(torture, 0, "ioctl_test"); printf("starting ioctl test\n"); @@ -786,7 +786,7 @@ static BOOL run_benchrw(struct torture_context *torture) torture_numops,torture_nprocs); /*init talloc context*/ - mem_ctx = talloc_init("bench-readwrite"); + mem_ctx = talloc_named_const(torture, 0, "bench-readwrite"); ev = event_context_init(mem_ctx); state = talloc_array(mem_ctx, struct benchrw_state *, torture_nprocs); diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c index 8d7552e0752..d66e11b01be 100644 --- a/source4/torture/smbtorture.c +++ b/source4/torture/smbtorture.c @@ -195,7 +195,7 @@ static void usage(poptContext pc) static BOOL is_binding_string(const char *binding_string) { - TALLOC_CTX *mem_ctx = talloc_init("is_binding_string"); + TALLOC_CTX *mem_ctx = talloc_named_const(NULL, 0, "is_binding_string"); struct dcerpc_binding *binding_struct; NTSTATUS status; diff --git a/source4/torture/util_smb.c b/source4/torture/util_smb.c index c1e4edc5e6f..b823e69b751 100644 --- a/source4/torture/util_smb.c +++ b/source4/torture/util_smb.c @@ -53,7 +53,7 @@ NTSTATUS create_directory_handle(struct smbcli_tree *tree, const char *dname, in union smb_open io; TALLOC_CTX *mem_ctx; - mem_ctx = talloc_init("create_directory_handle"); + mem_ctx = talloc_named_const(tree, 0, "create_directory_handle"); io.generic.level = RAW_OPEN_NTCREATEX; io.ntcreatex.in.root_fid = 0; @@ -329,7 +329,7 @@ void dump_all_info(TALLOC_CTX *mem_ctx, union smb_fileinfo *finfo) */ void torture_all_info(struct smbcli_tree *tree, const char *fname) { - TALLOC_CTX *mem_ctx = talloc_init("%s", fname); + TALLOC_CTX *mem_ctx = talloc_named(tree, 0, "%s", fname); union smb_fileinfo finfo; NTSTATUS status; @@ -373,7 +373,7 @@ NTSTATUS torture_set_sparse(struct smbcli_tree *tree, int fnum) NTSTATUS status; TALLOC_CTX *mem_ctx; - mem_ctx = talloc_init("torture_set_sparse"); + mem_ctx = talloc_named_const(tree, 0, "torture_set_sparse"); if (!mem_ctx) { return NT_STATUS_NO_MEMORY; }