summaryrefslogtreecommitdiff
path: root/source4/libcli
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/libcli
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/libcli')
-rw-r--r--source4/libcli/auth/ntlmssp.c2
-rw-r--r--source4/libcli/ldap/ldap.c8
-rw-r--r--source4/libcli/ldap/ldap_client.c2
-rw-r--r--source4/libcli/raw/clitransport.c4
-rw-r--r--source4/libcli/raw/rawrequest.c2
-rw-r--r--source4/libcli/raw/rawtrans.c8
-rw-r--r--source4/libcli/security/dom_sid.c2
-rw-r--r--source4/libcli/util/asn1.c4
8 files changed, 16 insertions, 16 deletions
diff --git a/source4/libcli/auth/ntlmssp.c b/source4/libcli/auth/ntlmssp.c
index 6ece0f6df6..7f4a86e274 100644
--- a/source4/libcli/auth/ntlmssp.c
+++ b/source4/libcli/auth/ntlmssp.c
@@ -109,7 +109,7 @@ void debug_ntlmssp_flags(uint32_t neg_flags)
static const uint8_t *get_challenge(const struct ntlmssp_state *ntlmssp_state)
{
- uint8_t *chal = talloc(ntlmssp_state, 8);
+ uint8_t *chal = talloc_size(ntlmssp_state, 8);
generate_random_buffer(chal, 8);
return chal;
diff --git a/source4/libcli/ldap/ldap.c b/source4/libcli/ldap/ldap.c
index 076d088ee2..b2a6bd957a 100644
--- a/source4/libcli/ldap/ldap.c
+++ b/source4/libcli/ldap/ldap.c
@@ -660,7 +660,7 @@ BOOL ldap_encode(struct ldap_message *msg, DATA_BLOB *result)
static const char *blob2string_talloc(TALLOC_CTX *mem_ctx,
DATA_BLOB blob)
{
- char *result = talloc(mem_ctx, blob.length+1);
+ char *result = talloc_size(mem_ctx, blob.length+1);
memcpy(result, blob.data, blob.length);
result[blob.length] = '\0';
return result;
@@ -859,7 +859,7 @@ BOOL ldap_decode(struct asn1_data *data, struct ldap_message *msg)
asn1_start_tag(data, ASN1_CONTEXT_SIMPLE(0));
pwlen = asn1_tag_remaining(data);
if (pwlen != 0) {
- char *pw = talloc(msg->mem_ctx, pwlen+1);
+ char *pw = talloc_size(msg->mem_ctx, pwlen+1);
asn1_read(data, pw, pwlen);
pw[pwlen] = '\0';
r->creds.password = pw;
@@ -1040,7 +1040,7 @@ BOOL ldap_decode(struct asn1_data *data, struct ldap_message *msg)
asn1_start_tag(data,
ASN1_APPLICATION_SIMPLE(LDAP_TAG_DelRequest));
len = asn1_tag_remaining(data);
- dn = talloc(msg->mem_ctx, len+1);
+ dn = talloc_size(msg->mem_ctx, len+1);
if (dn == NULL)
break;
asn1_read(data, dn, len);
@@ -1073,7 +1073,7 @@ BOOL ldap_decode(struct asn1_data *data, struct ldap_message *msg)
char *newsup;
asn1_start_tag(data, ASN1_CONTEXT_SIMPLE(0));
len = asn1_tag_remaining(data);
- newsup = talloc(msg->mem_ctx, len+1);
+ newsup = talloc_size(msg->mem_ctx, len+1);
if (newsup == NULL)
break;
asn1_read(data, newsup, len);
diff --git a/source4/libcli/ldap/ldap_client.c b/source4/libcli/ldap/ldap_client.c
index 9ca9e4b5c4..84fd0f1d64 100644
--- a/source4/libcli/ldap/ldap_client.c
+++ b/source4/libcli/ldap/ldap_client.c
@@ -649,7 +649,7 @@ BOOL ldap_find_single_string(struct ldap_message *msg, const char *attr,
if (!ldap_find_single_value(msg, attr, &blob))
return False;
- *value = talloc(mem_ctx, blob.length+1);
+ *value = talloc_size(mem_ctx, blob.length+1);
if (*value == NULL)
return False;
diff --git a/source4/libcli/raw/clitransport.c b/source4/libcli/raw/clitransport.c
index dde77eaeea..63ff1e4409 100644
--- a/source4/libcli/raw/clitransport.c
+++ b/source4/libcli/raw/clitransport.c
@@ -462,8 +462,8 @@ static void smbcli_transport_process_recv(struct smbcli_transport *transport)
if (transport->recv_buffer.received == NBT_HDR_SIZE) {
/* we've got a full header */
transport->recv_buffer.req_size = smb_len(transport->recv_buffer.header) + NBT_HDR_SIZE;
- transport->recv_buffer.buffer = talloc(transport,
- NBT_HDR_SIZE+transport->recv_buffer.req_size);
+ transport->recv_buffer.buffer = talloc_size(transport,
+ NBT_HDR_SIZE+transport->recv_buffer.req_size);
if (transport->recv_buffer.buffer == NULL) {
smbcli_transport_dead(transport);
return;
diff --git a/source4/libcli/raw/rawrequest.c b/source4/libcli/raw/rawrequest.c
index 178ccdbf48..b74f066ef4 100644
--- a/source4/libcli/raw/rawrequest.c
+++ b/source4/libcli/raw/rawrequest.c
@@ -83,7 +83,7 @@ struct smbcli_request *smbcli_request_setup_nonsmb(struct smbcli_transport *tran
/* over allocate by a small amount */
req->out.allocated = req->out.size + REQ_OVER_ALLOCATION;
- req->out.buffer = talloc(req, req->out.allocated);
+ req->out.buffer = talloc_size(req, req->out.allocated);
if (!req->out.buffer) {
return NULL;
}
diff --git a/source4/libcli/raw/rawtrans.c b/source4/libcli/raw/rawtrans.c
index 95555c3a82..0ccecdc2d4 100644
--- a/source4/libcli/raw/rawtrans.c
+++ b/source4/libcli/raw/rawtrans.c
@@ -87,7 +87,7 @@ NTSTATUS smb_raw_trans2_recv(struct smbcli_request *req,
/* allocate it */
if (total_data != 0) {
- tdata = talloc(mem_ctx, total_data);
+ tdata = talloc_size(mem_ctx, total_data);
if (!tdata) {
DEBUG(0,("smb_raw_receive_trans: failed to enlarge data buffer to %d bytes\n", total_data));
req->status = NT_STATUS_NO_MEMORY;
@@ -97,7 +97,7 @@ NTSTATUS smb_raw_trans2_recv(struct smbcli_request *req,
}
if (total_param != 0) {
- tparam = talloc(mem_ctx, total_param);
+ tparam = talloc_size(mem_ctx, total_param);
if (!tparam) {
DEBUG(0,("smb_raw_receive_trans: failed to enlarge param buffer to %d bytes\n", total_param));
req->status = NT_STATUS_NO_MEMORY;
@@ -111,7 +111,7 @@ NTSTATUS smb_raw_trans2_recv(struct smbcli_request *req,
if (parms->out.setup_count > 0) {
int i;
- parms->out.setup = talloc(mem_ctx, 2 * parms->out.setup_count);
+ parms->out.setup = talloc_array(mem_ctx, 2, parms->out.setup_count, "setup");
if (!parms->out.setup) {
req->status = NT_STATUS_NO_MEMORY;
return smbcli_request_destroy(req);
@@ -439,7 +439,7 @@ NTSTATUS smb_raw_nttrans_recv(struct smbcli_request *req,
if (parms->out.setup_count > 0) {
int i;
- parms->out.setup = talloc(mem_ctx, 2 * parms->out.setup_count);
+ parms->out.setup = talloc_array(mem_ctx, 2, parms->out.setup_count, "setup");
if (!parms->out.setup) {
req->status = NT_STATUS_NO_MEMORY;
return smbcli_request_destroy(req);
diff --git a/source4/libcli/security/dom_sid.c b/source4/libcli/security/dom_sid.c
index 368278708a..d76f9fa239 100644
--- a/source4/libcli/security/dom_sid.c
+++ b/source4/libcli/security/dom_sid.c
@@ -98,7 +98,7 @@ char *dom_sid_string(TALLOC_CTX *mem_ctx, const struct dom_sid *sid)
}
maxlen = sid->num_auths * 11 + 25;
- ret = talloc(mem_ctx, maxlen);
+ ret = talloc_size(mem_ctx, maxlen);
if (!ret) return talloc_strdup(mem_ctx, "(SID ERR)");
ia = (sid->id_auth[5]) +
diff --git a/source4/libcli/util/asn1.c b/source4/libcli/util/asn1.c
index 2bf29f9161..52ba0225c9 100644
--- a/source4/libcli/util/asn1.c
+++ b/source4/libcli/util/asn1.c
@@ -424,7 +424,7 @@ BOOL asn1_read_sequence_until(int sock, struct asn1_data *data,
len = b;
}
- buf = talloc(NULL, len);
+ buf = talloc_size(NULL, len);
if (buf == NULL)
return False;
@@ -548,7 +548,7 @@ BOOL asn1_read_GeneralString(struct asn1_data *data, char **s)
data->has_error = True;
return False;
}
- *s = talloc(NULL, len+1);
+ *s = talloc_size(NULL, len+1);
if (! *s) {
data->has_error = True;
return False;