From ddc10d4d37984246a6547e34a32d629c689c40d1 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 6 Jan 2005 03:06:58 +0000 Subject: 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) --- source4/torture/basic/charset.c | 2 +- source4/torture/gentest.c | 9 +++++---- source4/torture/raw/streams.c | 2 +- source4/torture/rpc/echo.c | 8 ++++---- source4/torture/rpc/netlogon.c | 4 ++-- source4/torture/rpc/samsync.c | 4 ++-- source4/torture/rpc/schannel.c | 4 ++-- source4/torture/rpc/svcctl.c | 2 +- source4/torture/rpc/xplogin.c | 3 +-- 9 files changed, 19 insertions(+), 19 deletions(-) (limited to 'source4/torture') 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;ntree, 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;ihash, 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; icount; i++) l.in.rids[i] = g.out.rids->rid[i].rid; -- cgit