summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-01-06 03:06:58 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:08:25 -0500
commitddc10d4d37984246a6547e34a32d629c689c40d1 (patch)
treebba9f8756de8fe38a6926edd0802aeff25abe0cf /source4/torture
parent0b54d9236fad72527ed1bcf4236767a09090d304 (diff)
downloadsamba-ddc10d4d37984246a6547e34a32d629c689c40d1.tar.gz
samba-ddc10d4d37984246a6547e34a32d629c689c40d1.tar.bz2
samba-ddc10d4d37984246a6547e34a32d629c689c40d1.zip
r4549: got rid of a lot more uses of plain talloc(), instead using
talloc_size() or talloc_array_p() where appropriate. also fixed a memory leak in pvfs_copy_file() (failed to free a memory context) (This used to be commit 89b74b53546e1570b11b3702f40bee58aed8c503)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/basic/charset.c2
-rw-r--r--source4/torture/gentest.c9
-rw-r--r--source4/torture/raw/streams.c2
-rw-r--r--source4/torture/rpc/echo.c8
-rw-r--r--source4/torture/rpc/netlogon.c4
-rw-r--r--source4/torture/rpc/samsync.c4
-rw-r--r--source4/torture/rpc/schannel.c4
-rw-r--r--source4/torture/rpc/svcctl.c2
-rw-r--r--source4/torture/rpc/xplogin.c3
9 files changed, 19 insertions, 19 deletions
diff --git a/source4/torture/basic/charset.c b/source4/torture/basic/charset.c
index 5154da8563..af6020da17 100644
--- a/source4/torture/basic/charset.c
+++ b/source4/torture/basic/charset.c
@@ -41,7 +41,7 @@ static NTSTATUS unicode_open(struct smbcli_tree *tree,
int i;
NTSTATUS status;
- ucs_name = talloc(mem_ctx, (1+u_name_len)*2);
+ ucs_name = talloc_size(mem_ctx, (1+u_name_len)*2);
if (!ucs_name) {
printf("Failed to create UCS2 Name - talloc() failure\n");
return NT_STATUS_NO_MEMORY;
diff --git a/source4/torture/gentest.c b/source4/torture/gentest.c
index 01b4022d32..5d8c7bf8fd 100644
--- a/source4/torture/gentest.c
+++ b/source4/torture/gentest.c
@@ -1330,8 +1330,8 @@ static BOOL handler_readx(int instance)
parm[0].readx.in.mincnt = gen_io_count();
parm[0].readx.in.maxcnt = gen_io_count();
parm[0].readx.in.remaining = gen_io_count();
- parm[0].readx.out.data = talloc(current_op.mem_ctx,
- MAX(parm[0].readx.in.mincnt, parm[0].readx.in.maxcnt));
+ parm[0].readx.out.data = talloc_size(current_op.mem_ctx,
+ MAX(parm[0].readx.in.mincnt, parm[0].readx.in.maxcnt));
GEN_COPY_PARM;
GEN_SET_FNUM(readx.in.fnum);
@@ -1392,8 +1392,9 @@ static BOOL handler_lockingx(int instance)
} while (nlocks == 0);
if (nlocks > 0) {
- parm[0].lockx.in.locks = talloc(current_op.mem_ctx,
- sizeof(parm[0].lockx.in.locks[0]) * nlocks);
+ parm[0].lockx.in.locks = talloc_array_p(current_op.mem_ctx,
+ struct smb_lock_entry,
+ nlocks);
for (n=0;n<nlocks;n++) {
parm[0].lockx.in.locks[n].pid = gen_pid();
parm[0].lockx.in.locks[n].offset = gen_offset();
diff --git a/source4/torture/raw/streams.c b/source4/torture/raw/streams.c
index 16c1bee3f1..dd03e1a125 100644
--- a/source4/torture/raw/streams.c
+++ b/source4/torture/raw/streams.c
@@ -71,7 +71,7 @@ static BOOL check_stream(struct smbcli_state *cli, TALLOC_CTX *mem_ctx,
return False;
}
- buf = talloc(mem_ctx, strlen(value)+11);
+ buf = talloc_size(mem_ctx, strlen(value)+11);
ret = smbcli_read(cli->tree, fnum, buf, 0, strlen(value)+11);
if (ret != strlen(value)) {
diff --git a/source4/torture/rpc/echo.c b/source4/torture/rpc/echo.c
index 5db438afd0..c547c71a83 100644
--- a/source4/torture/rpc/echo.c
+++ b/source4/torture/rpc/echo.c
@@ -62,8 +62,8 @@ static BOOL test_echodata(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
printf("\nTesting EchoData\n");
- data_in = talloc(mem_ctx, len);
- data_out = talloc(mem_ctx, len);
+ data_in = talloc_size(mem_ctx, len);
+ data_out = talloc_size(mem_ctx, len);
for (i=0;i<len;i++) {
data_in[i] = i;
}
@@ -109,7 +109,7 @@ static BOOL test_sourcedata(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
printf("\nTesting SourceData\n");
- data_out = talloc(mem_ctx, len);
+ data_out = talloc_size(mem_ctx, len);
r.in.len = len;
r.out.data = data_out;
@@ -144,7 +144,7 @@ static BOOL test_sinkdata(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
printf("\nTesting SinkData\n");
- data_in = talloc(mem_ctx, len);
+ data_in = talloc_size(mem_ctx, len);
for (i=0;i<len;i++) {
data_in[i] = i+1;
}
diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c
index 35f64933a9..93755fd049 100644
--- a/source4/torture/rpc/netlogon.c
+++ b/source4/torture/rpc/netlogon.c
@@ -346,10 +346,10 @@ static BOOL test_SamLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
generate_random_buffer(ninfo.challenge,
sizeof(ninfo.challenge));
ninfo.nt.length = 24;
- ninfo.nt.data = talloc(mem_ctx, 24);
+ ninfo.nt.data = talloc_size(mem_ctx, 24);
SMBNTencrypt(password, ninfo.challenge, ninfo.nt.data);
ninfo.lm.length = 24;
- ninfo.lm.data = talloc(mem_ctx, 24);
+ ninfo.lm.data = talloc_size(mem_ctx, 24);
SMBencrypt(password, ninfo.challenge, ninfo.lm.data);
r.in.server_name = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p));
diff --git a/source4/torture/rpc/samsync.c b/source4/torture/rpc/samsync.c
index 171e615196..d90f161849 100644
--- a/source4/torture/rpc/samsync.c
+++ b/source4/torture/rpc/samsync.c
@@ -58,7 +58,7 @@ static NTSTATUS test_SamLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
sizeof(ninfo.challenge));
if (nt_hash) {
ninfo.nt.length = 24;
- ninfo.nt.data = talloc(mem_ctx, 24);
+ ninfo.nt.data = talloc_size(mem_ctx, 24);
SMBOWFencrypt(nt_hash->hash, ninfo.challenge, ninfo.nt.data);
} else {
ninfo.nt.length = 0;
@@ -67,7 +67,7 @@ static NTSTATUS test_SamLogon(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
if (lm_hash) {
ninfo.lm.length = 24;
- ninfo.lm.data = talloc(mem_ctx, 24);
+ ninfo.lm.data = talloc_size(mem_ctx, 24);
SMBOWFencrypt(lm_hash->hash, ninfo.challenge, ninfo.lm.data);
} else {
ninfo.lm.length = 0;
diff --git a/source4/torture/rpc/schannel.c b/source4/torture/rpc/schannel.c
index 75fbe709b5..5ec466f0c1 100644
--- a/source4/torture/rpc/schannel.c
+++ b/source4/torture/rpc/schannel.c
@@ -79,10 +79,10 @@ static BOOL test_netlogon_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
generate_random_buffer(ninfo.challenge,
sizeof(ninfo.challenge));
ninfo.nt.length = 24;
- ninfo.nt.data = talloc(mem_ctx, 24);
+ ninfo.nt.data = talloc_size(mem_ctx, 24);
SMBNTencrypt(password, ninfo.challenge, ninfo.nt.data);
ninfo.lm.length = 24;
- ninfo.lm.data = talloc(mem_ctx, 24);
+ ninfo.lm.data = talloc_size(mem_ctx, 24);
SMBencrypt(password, ninfo.challenge, ninfo.lm.data);
diff --git a/source4/torture/rpc/svcctl.c b/source4/torture/rpc/svcctl.c
index efdf60bd3d..256f92b974 100644
--- a/source4/torture/rpc/svcctl.c
+++ b/source4/torture/rpc/svcctl.c
@@ -50,7 +50,7 @@ static BOOL test_EnumServicesStatus(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
if (W_ERROR_EQUAL(r.out.result, WERR_MORE_DATA)) {
r.in.buf_size = r.out.bytes_needed;
- r.out.service = talloc(mem_ctx, r.out.bytes_needed);
+ r.out.service = talloc_size(mem_ctx, r.out.bytes_needed);
status = dcerpc_svcctl_EnumServicesStatusW(p, mem_ctx, &r);
diff --git a/source4/torture/rpc/xplogin.c b/source4/torture/rpc/xplogin.c
index 5cd163039f..c50a489e42 100644
--- a/source4/torture/rpc/xplogin.c
+++ b/source4/torture/rpc/xplogin.c
@@ -730,8 +730,7 @@ static NTSTATUS test_getgroups(struct smbcli_transport *transport,
l.in.domain_handle = &domain_handle;
l.in.num_rids = g.out.rids->count;
- l.in.rids = talloc(mem_ctx,
- g.out.rids->count * sizeof(uint32_t));
+ l.in.rids = talloc_array_p(mem_ctx, uint32_t, g.out.rids->count);
for (i=0; i<g.out.rids->count; i++)
l.in.rids[i] = g.out.rids->rid[i].rid;