r4549: got rid of a lot more uses of plain talloc(), instead using
authorAndrew Tridgell <tridge@samba.org>
Thu, 6 Jan 2005 03:06:58 +0000 (03:06 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:08:25 +0000 (13:08 -0500)
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)

41 files changed:
source4/build/pidl/server.pm
source4/build/pidl/stub.pm
source4/dsdb/samdb/samdb.c
source4/ldap_server/ldap_parse.c
source4/lib/data_blob.c
source4/lib/genrand.c
source4/lib/registry/common/reg_util.c
source4/lib/registry/reg_backend_nt4.c
source4/lib/talloc/talloc.h
source4/lib/talloc/testsuite.c
source4/lib/util_str.c
source4/libcli/auth/ntlmssp.c
source4/libcli/ldap/ldap.c
source4/libcli/ldap/ldap_client.c
source4/libcli/raw/clitransport.c
source4/libcli/raw/rawrequest.c
source4/libcli/raw/rawtrans.c
source4/libcli/security/dom_sid.c
source4/libcli/util/asn1.c
source4/librpc/ndr/ndr.c
source4/librpc/rpc/dcerpc.c
source4/ntvfs/ntvfs_generic.c
source4/ntvfs/posix/pvfs_rename.c
source4/ntvfs/posix/pvfs_resolve.c
source4/ntvfs/posix/pvfs_util.c
source4/param/loadparm.c
source4/rpc_server/echo/rpc_echo.c
source4/rpc_server/remote/dcesrv_remote.c
source4/smb_server/reply.c
source4/smb_server/request.c
source4/smb_server/search.c
source4/torture/basic/charset.c
source4/torture/gentest.c
source4/torture/raw/streams.c
source4/torture/rpc/echo.c
source4/torture/rpc/netlogon.c
source4/torture/rpc/samsync.c
source4/torture/rpc/schannel.c
source4/torture/rpc/svcctl.c
source4/torture/rpc/xplogin.c
source4/utils/getntacl.c

index 9c72df105ba9c5f6ff35f3b6639da61a889a9a4c..bbb21f6e18a4a4d6c44695b978ba05800cef891c 100644 (file)
@@ -90,7 +90,7 @@ static NTSTATUS $name\__op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_C
                return NT_STATUS_NET_WRITE_FAULT;
        }
 
                return NT_STATUS_NET_WRITE_FAULT;
        }
 
-       *r = talloc(mem_ctx, dcerpc_table_$name.calls[opnum].struct_size);
+       *r = talloc_size(mem_ctx, dcerpc_table_$name.calls[opnum].struct_size);
        if (!*r) {
                return NT_STATUS_NO_MEMORY;
        }
        if (!*r) {
                return NT_STATUS_NO_MEMORY;
        }
index 42c83a467e0e8e01f507b08999662be8a119f235..9ef8004555a2972dd53d11baf69b3f6151dedeff 100644 (file)
@@ -94,7 +94,7 @@ static NTSTATUS $name\__op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_C
                return NT_STATUS_NET_WRITE_FAULT;
        }
 
                return NT_STATUS_NET_WRITE_FAULT;
        }
 
-       *r = talloc(mem_ctx, dcerpc_table_$name.calls[opnum].struct_size);
+       *r = talloc_size(mem_ctx, dcerpc_table_$name.calls[opnum].struct_size);
        if (!*r) {
                return NT_STATUS_NO_MEMORY;
        }
        if (!*r) {
                return NT_STATUS_NO_MEMORY;
        }
index 9a677249eb00da09fa6979f744ee1a3f59cce0ef..d84d07fca67be5bc29aa7ebd76865314d2468747 100644 (file)
@@ -841,12 +841,11 @@ int samdb_msg_add_hash(void *ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg,
 {
        struct ldb_wrap *sam_ctx = ctx;
        struct ldb_val val;
 {
        struct ldb_wrap *sam_ctx = ctx;
        struct ldb_val val;
-       val.data = talloc(mem_ctx, 16);
-       val.length = 16;
+       val.data = talloc_memdup(mem_ctx, hash.hash, 16);
        if (!val.data) {
                return -1;
        }
        if (!val.data) {
                return -1;
        }
-       memcpy(val.data, hash.hash, 16);
+       val.length = 16;
        return ldb_msg_add_value(sam_ctx->ldb, msg, attr_name, &val);
 }
 
        return ldb_msg_add_value(sam_ctx->ldb, msg, attr_name, &val);
 }
 
@@ -859,7 +858,7 @@ int samdb_msg_add_hashes(void *ctx, TALLOC_CTX *mem_ctx, struct ldb_message *msg
        struct ldb_wrap *sam_ctx = ctx;
        struct ldb_val val;
        int i;
        struct ldb_wrap *sam_ctx = ctx;
        struct ldb_val val;
        int i;
-       val.data = talloc(mem_ctx, count*16);
+       val.data = talloc_array(mem_ctx, 16, count, __location__);
        val.length = count*16;
        if (!val.data) {
                return -1;
        val.length = count*16;
        if (!val.data) {
                return -1;
index d645d24104560c774728da8f13ee2d553ae005e4..5db65ee99c8d4e9550da78d138d5a647ec8836c1 100644 (file)
@@ -272,7 +272,7 @@ struct ldap_dn *ldap_parse_dn(void *mem_ctx, const char *orig_dn)
                }
 
                /* rebuild the normlaized component and put it here */
                }
 
                /* rebuild the normlaized component and put it here */
-               component->component = dest = talloc(component, size);
+               component->component = dest = talloc_size(component, size);
                for (i = 0; i < component->attr_num; i++) {
                        if (i != 0) {
                                *dest = '+';
                for (i = 0; i < component->attr_num; i++) {
                        if (i != 0) {
                                *dest = '+';
@@ -303,7 +303,7 @@ struct ldap_dn *ldap_parse_dn(void *mem_ctx, const char *orig_dn)
        }
 
        /* rebuild the normlaized dn and put it here */
        }
 
        /* rebuild the normlaized dn and put it here */
-       dn->dn = dest = talloc(dn, size);
+       dn->dn = dest = talloc_size(dn, size);
        for (i = 0; i < dn->comp_num; i++) {
                if (i != 0) {
                        *dest = ',';
        for (i = 0; i < dn->comp_num; i++) {
                if (i != 0) {
                        *dest = ',';
index 18ecc2793ac7e14eab1dc417ee70fcedb391065a..deb8f55fce279a47da28073f2beae87b3228ca99 100644 (file)
@@ -37,7 +37,7 @@ DATA_BLOB data_blob_named(const void *p, size_t length, const char *name)
        if (p) {
                ret.data = talloc_memdup(NULL, p, length);
        } else {
        if (p) {
                ret.data = talloc_memdup(NULL, p, length);
        } else {
-               ret.data = talloc(NULL, length);
+               ret.data = talloc_size(NULL, length);
        }
        if (ret.data == NULL) {
                ret.length = 0;
        }
        if (ret.data == NULL) {
                ret.length = 0;
index b4651dffe86110de27eb317af34c09a92e239274..e11f37e0e9f804be3aee76d0f94a0c9f92c2cbf7 100644 (file)
@@ -268,7 +268,7 @@ char *generate_random_str_list(TALLOC_CTX *mem_ctx, size_t len, const char *list
        size_t i;
        size_t list_len = strlen(list);
 
        size_t i;
        size_t list_len = strlen(list);
 
-       char *retstr = talloc(mem_ctx, len + 1);
+       char *retstr = talloc_array_p(mem_ctx, char, len + 1);
        if (!retstr) return NULL;
 
        generate_random_buffer((uint8_t *)retstr, len);
        if (!retstr) return NULL;
 
        generate_random_buffer((uint8_t *)retstr, len);
index 3a1736914408f3b2e181fe89ab923ee25f9513ef..67c62fe5c86f82b0feb4d3d61b8455e95a8a007d 100644 (file)
@@ -63,7 +63,7 @@ char *reg_val_data_string(TALLOC_CTX *mem_ctx, struct registry_value *v)
          return ret;
 
   case REG_BINARY:
          return ret;
 
   case REG_BINARY:
-         ret = talloc(mem_ctx, v->data_len * 3 + 2);
+         ret = talloc_array(mem_ctx, 3, v->data_len+1, "REG_BINARY");
          asciip = ret;
          for (i=0; i<v->data_len; i++) { 
                  int str_rem = v->data_len * 3 - (asciip - ret);
          asciip = ret;
          for (i=0; i<v->data_len; i++) { 
                  int str_rem = v->data_len * 3 - (asciip - ret);
index 6c48b9bd1b50581bfb30f49bc83f1a6231be2760..cd3be85a23e1f3d207d3bd21d734e94cff4f5218 100644 (file)
@@ -917,7 +917,7 @@ static WERROR vk_to_val(TALLOC_CTX *mem_ctx, struct registry_key *parent, VK_HDR
 
        if (dat_len&0x7FFFFFFF) {
 
 
        if (dat_len&0x7FFFFFFF) {
 
-               char *dtmp = (char *)talloc(mem_ctx, dat_len&0x7FFFFFFF);
+               char *dtmp = talloc_size(mem_ctx, dat_len&0x7FFFFFFF);
 
                if ((dat_len&0x80000000) == 0) { /* The data is pointed to by the offset */
                        char *dat_ptr = LOCN(regf->base, dat_off);
 
                if ((dat_len&0x80000000) == 0) { /* The data is pointed to by the offset */
                        char *dat_ptr = LOCN(regf->base, dat_off);
index ee3e0be8eb3dee0544260c1422ed00970986a8d0..99a6b7a770dfc0f05ecefe95187c119fcf03ec69 100644 (file)
@@ -34,6 +34,7 @@ typedef void TALLOC_CTX;
 
 /* useful macros for creating type checked pointers */
 #define talloc(ctx, size) talloc_named_const(ctx, size, __location__)
 
 /* useful macros for creating type checked pointers */
 #define talloc(ctx, size) talloc_named_const(ctx, size, __location__)
+#define talloc_size(ctx, size) talloc_named_const(ctx, size, __location__)
 #define talloc_zero(ctx, size) _talloc_zero(ctx, size, __location__)
 #define talloc_realloc(ctx, ptr, size) _talloc_realloc(ctx, ptr, size, __location__)
 #define talloc_p(ctx, type) (type *)talloc_named_const(ctx, sizeof(type), #type)
 #define talloc_zero(ctx, size) _talloc_zero(ctx, size, __location__)
 #define talloc_realloc(ctx, ptr, size) _talloc_realloc(ctx, ptr, size, __location__)
 #define talloc_p(ctx, type) (type *)talloc_named_const(ctx, sizeof(type), #type)
index a3a448ef40864cbe9e10136ac50e809551825c8e..ced32171052fcadc35076bceaa4f7a17156fcc45 100644 (file)
@@ -335,7 +335,7 @@ static BOOL test_misc(void)
 
        root = talloc_new(NULL);
 
 
        root = talloc_new(NULL);
 
-       p1 = talloc(root, 0x7fffffff);
+       p1 = talloc_size(root, 0x7fffffff);
        if (p1) {
                printf("failed: large talloc allowed\n");
                return False;
        if (p1) {
                printf("failed: large talloc allowed\n");
                return False;
@@ -517,7 +517,7 @@ static BOOL test_realloc(void)
 
        root = talloc_new(NULL);
 
 
        root = talloc_new(NULL);
 
-       p1 = talloc(root, 10);
+       p1 = talloc_size(root, 10);
        CHECK_SIZE(p1, 10);
 
        p1 = talloc_realloc(NULL, p1, 20);
        CHECK_SIZE(p1, 10);
 
        p1 = talloc_realloc(NULL, p1, 20);
@@ -581,7 +581,7 @@ static BOOL test_realloc_child(void)
 
        printf("TESTING REALLOC WITH CHILD\n");
 
 
        printf("TESTING REALLOC WITH CHILD\n");
 
-       root = talloc(NULL, 0);
+       root = talloc_new(NULL);
 
        el1 = talloc_p(root, struct el1);
        el1->list = talloc_p(el1, struct el2 *);
 
        el1 = talloc_p(root, struct el1);
        el1->list = talloc_p(el1, struct el2 *);
@@ -607,7 +607,7 @@ static BOOL test_steal(void)
 
        printf("TESTING STEAL\n");
 
 
        printf("TESTING STEAL\n");
 
-       root = talloc(NULL, 0);
+       root = talloc_new(NULL);
 
        p1 = talloc_array_p(root, char, 10);
        CHECK_SIZE(p1, 10);
 
        p1 = talloc_array_p(root, char, 10);
        CHECK_SIZE(p1, 10);
@@ -645,7 +645,7 @@ static BOOL test_steal(void)
 
        talloc_free(root);
 
 
        talloc_free(root);
 
-       p1 = talloc(NULL, 3);
+       p1 = talloc_new(NULL);
        CHECK_SIZE(NULL, 3);
        talloc_free(p1);
 
        CHECK_SIZE(NULL, 3);
        talloc_free(p1);
 
@@ -661,7 +661,7 @@ static BOOL test_ldb(void)
 
        printf("TESTING LDB\n");
 
 
        printf("TESTING LDB\n");
 
-       root = talloc(NULL, 0);
+       root = talloc_new(NULL);
 
        p1 = talloc_realloc_fn(root, NULL, 10);
        CHECK_BLOCKS(root, 2);
 
        p1 = talloc_realloc_fn(root, NULL, 10);
        CHECK_BLOCKS(root, 2);
@@ -709,7 +709,7 @@ static BOOL test_unref_reparent(void)
 */
 static BOOL test_speed(void)
 {
 */
 static BOOL test_speed(void)
 {
-       void *ctx = talloc(NULL, 0);
+       void *ctx = talloc_new(NULL);
        unsigned count;
        struct timeval tv;
 
        unsigned count;
        struct timeval tv;
 
@@ -719,9 +719,9 @@ static BOOL test_speed(void)
        count = 0;
        do {
                void *p1, *p2, *p3;
        count = 0;
        do {
                void *p1, *p2, *p3;
-               p1 = talloc(ctx, count);
+               p1 = talloc_size(ctx, count);
                p2 = talloc_strdup(p1, "foo bar");
                p2 = talloc_strdup(p1, "foo bar");
-               p3 = talloc(p1, 300);
+               p3 = talloc_size(p1, 300);
                talloc_free(p1);
                count += 3;
        } while (timeval_elapsed(&tv) < 5.0);
                talloc_free(p1);
                count += 3;
        } while (timeval_elapsed(&tv) < 5.0);
index 82481cca2645810ede51cde99e8b3870e58753f8..b3ec27de743e9b77f62e9377f0ef4e62e29d5623 100644 (file)
@@ -669,7 +669,7 @@ char *strlower_talloc(TALLOC_CTX *ctx, const char *src)
 
        /* this takes advantage of the fact that upper/lower can't
           change the length of a character by more than 1 byte */
 
        /* this takes advantage of the fact that upper/lower can't
           change the length of a character by more than 1 byte */
-       dest = talloc(ctx, 2*(strlen(src))+1);
+       dest = talloc_size(ctx, 2*(strlen(src))+1);
        if (dest == NULL) {
                return NULL;
        }
        if (dest == NULL) {
                return NULL;
        }
@@ -704,7 +704,7 @@ char *strupper_talloc(TALLOC_CTX *ctx, const char *src)
 
        /* this takes advantage of the fact that upper/lower can't
           change the length of a character by more than 1 byte */
 
        /* this takes advantage of the fact that upper/lower can't
           change the length of a character by more than 1 byte */
-       dest = talloc(ctx, 2*(strlen(src))+1);
+       dest = talloc_size(ctx, 2*(strlen(src))+1);
        if (dest == NULL) {
                return NULL;
        }
        if (dest == NULL) {
                return NULL;
        }
@@ -1030,7 +1030,7 @@ const char *str_format_nbt_domain(TALLOC_CTX *mem_ctx, const char *s)
        if (!s || !*s) {
                return talloc_strdup(mem_ctx, "");
        }
        if (!s || !*s) {
                return talloc_strdup(mem_ctx, "");
        }
-       ret = talloc(mem_ctx, strlen(s)+2);
+       ret = talloc_size(mem_ctx, strlen(s)+2);
        if (!ret) {
                return ret;
        }
        if (!ret) {
                return ret;
        }
@@ -1133,7 +1133,7 @@ char *attrib_string(TALLOC_CTX *mem_ctx, uint32_t attrib)
        };
        char *ret;
 
        };
        char *ret;
 
-       ret = talloc(mem_ctx, ARRAY_SIZE(attr_strs)+1);
+       ret = talloc_size(mem_ctx, ARRAY_SIZE(attr_strs)+1);
        if (!ret) {
                return NULL;
        }
        if (!ret) {
                return NULL;
        }
index 6ece0f6df611c3479dba2fd8b410b665294a0450..7f4a86e2746e96cb814ea507835c4903172dee11 100644 (file)
@@ -109,7 +109,7 @@ void debug_ntlmssp_flags(uint32_t neg_flags)
    
 static const uint8_t *get_challenge(const struct ntlmssp_state *ntlmssp_state)
 {
    
 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;
        generate_random_buffer(chal, 8);
 
        return chal;
index 076d088ee260162833136da209940c7455ff6127..b2a6bd957a90c77a0494044b5c14f977a53f0f3c 100644 (file)
@@ -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)
 {
 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;
        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) {
                        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;
                                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);
                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);
                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);
                        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);
                        if (newsup == NULL)
                                break;
                        asn1_read(data, newsup, len);
index 9ca9e4b5c4255a84ff87522bd55af7bdeaf2d22a..84fd0f1d645dde4485c2e83d366b964158473dd3 100644 (file)
@@ -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;
 
        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;
 
        if (*value == NULL)
                return False;
index dde77eaeea52804618332e0932326672784e1ca4..63ff1e44090027036bde0625d36618f946554618 100644 (file)
@@ -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;
                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;
                        if (transport->recv_buffer.buffer == NULL) {
                                smbcli_transport_dead(transport);
                                return;
index 178ccdbf48351d1c1219aa8ac615052efe997c7e..b74f066ef464a5066a8d7978809c24986079c192 100644 (file)
@@ -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; 
 
        /* 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;
        }
        if (!req->out.buffer) {
                return NULL;
        }
index 95555c3a826a8a4274215695575df57bed68881f..0ccecdc2d46b4ec8453925129c31dae93458be7b 100644 (file)
@@ -87,7 +87,7 @@ NTSTATUS smb_raw_trans2_recv(struct smbcli_request *req,
 
        /* allocate it */
        if (total_data != 0) {
 
        /* 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;
                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) {
        }
 
        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;
                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;
 
        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);
                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;
 
        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);
                if (!parms->out.setup) {
                        req->status = NT_STATUS_NO_MEMORY;
                        return smbcli_request_destroy(req);
index 368278708ac00fde8131f4530cdb240bf4d5b919..d76f9fa2392bec46383df4f48484fd12368208c6 100644 (file)
@@ -98,7 +98,7 @@ char *dom_sid_string(TALLOC_CTX *mem_ctx, const struct dom_sid *sid)
        }
 
        maxlen = sid->num_auths * 11 + 25;
        }
 
        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]) +
        if (!ret) return talloc_strdup(mem_ctx, "(SID ERR)");
 
        ia = (sid->id_auth[5]) +
index 2bf29f9161966b3bafb9772fd1d016a04c2773a1..52ba0225c9f5f0167c936e9cae3e542d574f5098 100644 (file)
@@ -424,7 +424,7 @@ BOOL asn1_read_sequence_until(int sock, struct asn1_data *data,
                len = b;
        }
 
                len = b;
        }
 
-       buf = talloc(NULL, len);
+       buf = talloc_size(NULL, len);
        if (buf == NULL)
                return False;
 
        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;
        }
                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;
        if (! *s) {
                data->has_error = True;
                return False;
index 44915bac5bad7d30cbbfd326912751016800d28e..9ec22cdb7945e6f2d9445f59950f84f331d545f6 100644 (file)
@@ -128,7 +128,7 @@ struct ndr_push *ndr_push_init_ctx(TALLOC_CTX *mem_ctx)
 
        ndr->flags = 0;
        ndr->alloc_size = NDR_BASE_MARSHALL_SIZE;
 
        ndr->flags = 0;
        ndr->alloc_size = NDR_BASE_MARSHALL_SIZE;
-       ndr->data = talloc(ndr, ndr->alloc_size);
+       ndr->data = talloc_array_p(ndr, uint8_t, ndr->alloc_size);
        if (!ndr->data) {
                return NULL;
        }
        if (!ndr->data) {
                return NULL;
        }
index 3fe2d87475e2268aecf2290103dd5b1a19e721c9..9a8de8c0ad610ecd7b0c1c5cf8c0e4095c3c81f6 100644 (file)
@@ -1032,7 +1032,7 @@ static NTSTATUS dcerpc_ndr_validate_in(struct dcerpc_pipe *p,
        NTSTATUS status;
        DATA_BLOB blob2;
 
        NTSTATUS status;
        DATA_BLOB blob2;
 
-       st = talloc(mem_ctx, struct_size);
+       st = talloc_size(mem_ctx, struct_size);
        if (!st) {
                return NT_STATUS_NO_MEMORY;
        }
        if (!st) {
                return NT_STATUS_NO_MEMORY;
        }
@@ -1096,7 +1096,7 @@ static NTSTATUS dcerpc_ndr_validate_out(struct dcerpc_pipe *p,
        NTSTATUS status;
        DATA_BLOB blob, blob2;
 
        NTSTATUS status;
        DATA_BLOB blob, blob2;
 
-       st = talloc(mem_ctx, struct_size);
+       st = talloc_size(mem_ctx, struct_size);
        if (!st) {
                return NT_STATUS_NO_MEMORY;
        }
        if (!st) {
                return NT_STATUS_NO_MEMORY;
        }
index 407bd38f7453555d50b4b13459d1bb5359e0cc43..051e92b19cea33790878f458f6a1009e1861ce01 100644 (file)
@@ -713,8 +713,10 @@ NTSTATUS ntvfs_map_fileinfo(struct smbsrv_request *req, union smb_fileinfo *info
        case RAW_FILEINFO_STREAM_INFORMATION:
                info->stream_info.out.num_streams = info2->generic.out.num_streams;
                if (info->stream_info.out.num_streams > 0) {
        case RAW_FILEINFO_STREAM_INFORMATION:
                info->stream_info.out.num_streams = info2->generic.out.num_streams;
                if (info->stream_info.out.num_streams > 0) {
-                       info->stream_info.out.streams = talloc(req, 
-                               info->stream_info.out.num_streams * sizeof(struct stream_struct));
+                       info->stream_info.out.streams = 
+                               talloc_array_p(req, 
+                                              struct stream_struct,
+                                              info->stream_info.out.num_streams);
                        if (!info->stream_info.out.streams) {
                                DEBUG(2,("ntvfs_map_fileinfo: no memory for %d streams\n",
                                        info->stream_info.out.num_streams));
                        if (!info->stream_info.out.streams) {
                                DEBUG(2,("ntvfs_map_fileinfo: no memory for %d streams\n",
                                        info->stream_info.out.num_streams));
@@ -751,8 +753,9 @@ NTSTATUS ntvfs_map_fileinfo(struct smbsrv_request *req, union smb_fileinfo *info
        case RAW_FILEINFO_ALL_EAS:
                info->all_eas.out.num_eas = info2->generic.out.num_eas;
                if (info->all_eas.out.num_eas > 0) {
        case RAW_FILEINFO_ALL_EAS:
                info->all_eas.out.num_eas = info2->generic.out.num_eas;
                if (info->all_eas.out.num_eas > 0) {
-                       info->all_eas.out.eas = talloc(req, 
-                               info->all_eas.out.num_eas * sizeof(struct ea_struct));
+                       info->all_eas.out.eas = talloc_array_p(req, 
+                                                              struct ea_struct,
+                                                              info->all_eas.out.num_eas);
                        if (!info->all_eas.out.eas) {
                                DEBUG(2,("ntvfs_map_fileinfo: no memory for %d eas\n",
                                        info->all_eas.out.num_eas));
                        if (!info->all_eas.out.eas) {
                                DEBUG(2,("ntvfs_map_fileinfo: no memory for %d eas\n",
                                        info->all_eas.out.num_eas));
index 8e057f214b9a74b43c684dad958d7f7094192f15..3203f7fa86de1d164b4757cc2c63dbc98ad0c5b0 100644 (file)
@@ -35,7 +35,7 @@ static const char *pvfs_resolve_wildcard_component(TALLOC_CTX *mem_ctx,
        char *dest, *d;
 
        /* the length is bounded by the length of the two strings combined */
        char *dest, *d;
 
        /* the length is bounded by the length of the two strings combined */
-       dest = talloc(mem_ctx, strlen(fname) + strlen(pattern) + 1);
+       dest = talloc_size(mem_ctx, strlen(fname) + strlen(pattern) + 1);
        if (dest == NULL) {
                return NULL;
        }
        if (dest == NULL) {
                return NULL;
        }
index 4ad34767950577aff649cbc3d625d1e5310e895f..fc1576b955440a83d4495e952e14bb8a8f42d196 100644 (file)
@@ -412,7 +412,7 @@ static NTSTATUS pvfs_reduce_name(TALLOC_CTX *mem_ctx, const char **fname, uint_t
        }
 
        /* rebuild the name */
        }
 
        /* rebuild the name */
-       ret = talloc(mem_ctx, len+1);
+       ret = talloc_size(mem_ctx, len+1);
        if (ret == NULL) {
                talloc_free(s);
                return NT_STATUS_NO_MEMORY;
        if (ret == NULL) {
                talloc_free(s);
                return NT_STATUS_NO_MEMORY;
index 6026b9fbf38a680b115785f6f1465ce09df5539b..eb0f04728c0a2dcdfe9cee45b78c3b45126b18d4 100644 (file)
@@ -89,7 +89,7 @@ NTSTATUS pvfs_copy_file(struct pvfs_state *pvfs,
        mode_t mode;
        NTSTATUS status;
        size_t buf_size = 0x10000;
        mode_t mode;
        NTSTATUS status;
        size_t buf_size = 0x10000;
-       char *buf = talloc(name2, buf_size);
+       char *buf = talloc_size(name2, buf_size);
 
        if (buf == NULL) {
                return NT_STATUS_NO_MEMORY;
 
        if (buf == NULL) {
                return NT_STATUS_NO_MEMORY;
@@ -134,6 +134,7 @@ NTSTATUS pvfs_copy_file(struct pvfs_state *pvfs,
                }
        }
 
                }
        }
 
+       talloc_free(buf);
        close(fd1);
 
        mode = pvfs_fileperms(pvfs, name1->dos.attrib);
        close(fd1);
 
        mode = pvfs_fileperms(pvfs, name1->dos.attrib);
index da23dd02efc1469137113d0edabff23d0cb28fa7..526ec8b85b0e53cd566308c13e31aff97624e7a4 100644 (file)
@@ -1086,7 +1086,7 @@ static const char *lp_string(const char *s)
        if (!lp_talloc)
                lp_talloc = talloc_init("lp_talloc");
 
        if (!lp_talloc)
                lp_talloc = talloc_init("lp_talloc");
 
-       ret = (char *)talloc(lp_talloc, len + 100);     /* leave room for substitution */
+       ret = talloc_array_p(lp_talloc, char, len + 100);       /* leave room for substitution */
 
        if (!ret)
                return NULL;
 
        if (!ret)
                return NULL;
index 543bca1073c19ae69b04a6965638ea9b9f15f861..e5c1ee56cee606a45eef1cac36c79935b43f1a81 100644 (file)
@@ -37,11 +37,10 @@ static NTSTATUS echo_EchoData(struct dcesrv_call_state *dce_call, TALLOC_CTX *me
                return NT_STATUS_OK;
        }
 
                return NT_STATUS_OK;
        }
 
-       r->out.out_data = talloc(mem_ctx, r->in.len);
+       r->out.out_data = talloc_memdup(mem_ctx, r->in.in_data, r->in.len);
        if (!r->out.out_data) {
                return NT_STATUS_NO_MEMORY;
        }
        if (!r->out.out_data) {
                return NT_STATUS_NO_MEMORY;
        }
-       memcpy(r->out.out_data, r->in.in_data, r->in.len);
 
        return NT_STATUS_OK;
 }
 
        return NT_STATUS_OK;
 }
index 3bf917ac7182a704ab869cef62b34e89154d85e0..8feb54a500c8697df9be3b525f7ee4ef76bd126f 100644 (file)
@@ -77,7 +77,7 @@ static NTSTATUS remote_op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_CT
                return NT_STATUS_NET_WRITE_FAULT;
        }
 
                return NT_STATUS_NET_WRITE_FAULT;
        }
 
-       *r = talloc(mem_ctx, table->calls[opnum].struct_size);
+       *r = talloc_size(mem_ctx, table->calls[opnum].struct_size);
        if (!*r) {
                return NT_STATUS_NO_MEMORY;
        }
        if (!*r) {
                return NT_STATUS_NO_MEMORY;
        }
index 980f48bf57e97d985254a96c7f1618ed6ee1f1a3..0b49512663c7d0b0aec2026f234ffcf912d37483 100644 (file)
@@ -45,7 +45,7 @@
        
 /* useful wrapper for talloc with NO_MEMORY reply */
 #define REQ_TALLOC(ptr, size) do { \
        
 /* useful wrapper for talloc with NO_MEMORY reply */
 #define REQ_TALLOC(ptr, size) do { \
-       ptr = talloc(req, size); \
+       ptr = talloc_size(req, size); \
        if (!ptr) { \
                req_reply_error(req, NT_STATUS_NO_MEMORY); \
                return; \
        if (!ptr) { \
                req_reply_error(req, NT_STATUS_NO_MEMORY); \
                return; \
@@ -696,7 +696,7 @@ void reply_readbraw(struct smbsrv_request *req)
        /* before calling the backend we setup the raw buffer. This
         * saves a copy later */
        req->out.size = io.readbraw.in.maxcnt + NBT_HDR_SIZE;
        /* before calling the backend we setup the raw buffer. This
         * saves a copy later */
        req->out.size = io.readbraw.in.maxcnt + NBT_HDR_SIZE;
-       req->out.buffer = talloc(req, req->out.size);
+       req->out.buffer = talloc_size(req, req->out.size);
        if (req->out.buffer == NULL) {
                goto failed;
        }
        if (req->out.buffer == NULL) {
                goto failed;
        }
@@ -720,7 +720,7 @@ void reply_readbraw(struct smbsrv_request *req)
 failed:
        /* any failure in readbraw is equivalent to reading zero bytes */
        req->out.size = 4;
 failed:
        /* any failure in readbraw is equivalent to reading zero bytes */
        req->out.size = 4;
-       req->out.buffer = talloc(req, req->out.size);
+       req->out.buffer = talloc_size(req, req->out.size);
        SIVAL(req->out.buffer, 0, 0); /* init NBT header */
 
        req_send_reply_nosign(req);
        SIVAL(req->out.buffer, 0, 0); /* init NBT header */
 
        req_send_reply_nosign(req);
index 417d5fbcfcf97a85b30cc08d17c63101cdc5a1d7..bd33e8cfc76cea7f36a5f516980674359b34a26c 100644 (file)
@@ -120,7 +120,7 @@ void req_setup_reply(struct smbsrv_request *req, uint_t wct, uint_t buflen)
        /* over allocate by a small amount */
        req->out.allocated = req->out.size + REQ_OVER_ALLOCATION; 
 
        /* 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) {
                smbsrv_terminate_connection(req->smb_conn, "allocation failed");
                return;
        if (!req->out.buffer) {
                smbsrv_terminate_connection(req->smb_conn, "allocation failed");
                return;
index b017c996ef2969a1b149c02b3e73568dd3748de5..3ec66a0f334ce4079fcbc2457bdfbc47c9bc34d9 100644 (file)
@@ -45,7 +45,7 @@
 
 /* useful wrapper for talloc with NO_MEMORY reply */
 #define REQ_TALLOC(ptr) do { \
 
 /* useful wrapper for talloc with NO_MEMORY reply */
 #define REQ_TALLOC(ptr) do { \
-       ptr = talloc(req, sizeof(*(ptr))); \
+       ptr = talloc_size(req, sizeof(*(ptr))); \
        if (!ptr) { \
                req_reply_error(req, NT_STATUS_NO_MEMORY); \
                return; \
        if (!ptr) { \
                req_reply_error(req, NT_STATUS_NO_MEMORY); \
                return; \
index 5154da85630ab2e72ea02d147726ac59f32fc822..af6020da17af8939fa305829d0ddd6a9ec6fe709 100644 (file)
@@ -41,7 +41,7 @@ static NTSTATUS unicode_open(struct smbcli_tree *tree,
        int i;
        NTSTATUS status;
 
        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;
        if (!ucs_name) {
                printf("Failed to create UCS2 Name - talloc() failure\n");
                return NT_STATUS_NO_MEMORY;
index 01b4022d324d37f0b7eee83ec60c2624eb98bec8..5d8c7bf8fdbc6d6583ba0140ec8016f87ff67904 100644 (file)
@@ -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.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);
 
        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) {
        } 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();
                for (n=0;n<nlocks;n++) {
                        parm[0].lockx.in.locks[n].pid = gen_pid();
                        parm[0].lockx.in.locks[n].offset = gen_offset();
index 16c1bee3f1139edb558a8d4c69c7867b75ef30d6..dd03e1a1251a34d5f35f8e2fe820430fdfd94b21 100644 (file)
@@ -71,7 +71,7 @@ static BOOL check_stream(struct smbcli_state *cli, TALLOC_CTX *mem_ctx,
                return False;
        }
 
                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)) {
        
        ret = smbcli_read(cli->tree, fnum, buf, 0, strlen(value)+11);
        if (ret != strlen(value)) {
index 5db438afd0b802a3ad2236a63c77c45da7ac0eaa..c547c71a83189732796ef59055940567090947ad 100644 (file)
@@ -62,8 +62,8 @@ static BOOL test_echodata(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx)
 
        printf("\nTesting EchoData\n");
 
 
        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;
        }
        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");
 
 
        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;
 
        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");
 
 
        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;
        }
        for (i=0;i<len;i++) {
                data_in[i] = i+1;
        }
index 35f64933a9d6b54d5b86004a3585038f7f5e9776..93755fd04955984f098e95042542784f78312a95 100644 (file)
@@ -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;
        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;
        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));
        SMBencrypt(password, ninfo.challenge, ninfo.lm.data);
 
        r.in.server_name = talloc_asprintf(mem_ctx, "\\\\%s", dcerpc_server_name(p));
index 171e615196aa6774ab940ac92dce7f1b4bcba2d0..d90f1618497a5e35fbc27656358260cffa0790ff 100644 (file)
@@ -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;
                               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;
                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;
        
        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;
                SMBOWFencrypt(lm_hash->hash, ninfo.challenge, ninfo.lm.data);
        } else {
                ninfo.lm.length = 0;
index 75fbe709b5e23d46049c744099de55a25d9fbee0..5ec466f0c133f9a01eceddfeeefbf6f69690cce7 100644 (file)
@@ -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;
        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;
        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);
 
 
        SMBencrypt(password, ninfo.challenge, ninfo.lm.data);
 
 
index efdf60bd3d1685204da17cb9a6703c91979e4cd6..256f92b974fc0811064f8a86bdb7e3bc05797ad6 100644 (file)
@@ -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;
 
        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);
 
                
                status = dcerpc_svcctl_EnumServicesStatusW(p, mem_ctx, &r);
 
index 5cd163039f681b6f1414d9af193b157a5641df0f..c50a489e422bf61f4113f71660a1bebe9e6c78ec 100644 (file)
@@ -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.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;
 
                for (i=0; i<g.out.rids->count; i++)
                        l.in.rids[i] = g.out.rids->rid[i].rid;
index 034224c66d2d24e9ba60c565def7bbfd2de557a5..762167a93ae56f96fa312debb01e7b23556cace0 100644 (file)
@@ -112,7 +112,7 @@ int main(int argc, char **argv)
                exit(1);
        }
 
                exit(1);
        }
 
-       data = talloc(mem_ctx, size);
+       data = talloc_size(mem_ctx, size);
 
        size = getxattr(argv[1], "security.ntacl", data, size);
 
 
        size = getxattr(argv[1], "security.ntacl", data, size);