diff options
author | Andrew Bartlett <abartlet@samba.org> | 2011-06-07 11:30:12 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-06-09 12:40:08 +0200 |
commit | 3d15137653a7d1b593a9af2eef12f6e5b9a04c4f (patch) | |
tree | 325ef987dfbb77144bcb7753c4936cbc8d05379b | |
parent | 73b377432c5efb8451f09f6d25d8aa1b28c239c9 (diff) | |
download | samba-3d15137653a7d1b593a9af2eef12f6e5b9a04c4f.tar.gz samba-3d15137653a7d1b593a9af2eef12f6e5b9a04c4f.tar.bz2 samba-3d15137653a7d1b593a9af2eef12f6e5b9a04c4f.zip |
s3-talloc Change TALLOC_ARRAY() to talloc_array()
Using the standard macro makes it easier to move code into common, as
TALLOC_ARRAY isn't standard talloc.
84 files changed, 182 insertions, 183 deletions
diff --git a/lib/addns/dnsmarshall.c b/lib/addns/dnsmarshall.c index e5e8cf7962..3401b31469 100644 --- a/lib/addns/dnsmarshall.c +++ b/lib/addns/dnsmarshall.c @@ -39,7 +39,7 @@ struct dns_buffer *dns_create_buffer(TALLOC_CTX *mem_ctx) */ result->size = 2; - if (!(result->data = TALLOC_ARRAY(result, uint8, result->size))) { + if (!(result->data = talloc_array(result, uint8, result->size))) { TALLOC_FREE(result); return NULL; } @@ -223,7 +223,7 @@ static void dns_unmarshall_label(TALLOC_CTX *mem_ctx, label->len = len; - if (!(label->label = TALLOC_ARRAY(label, char, len+1))) { + if (!(label->label = talloc_array(label, char, len+1))) { buf->error = ERROR_DNS_NO_MEMORY; goto error; } @@ -329,7 +329,7 @@ static void dns_unmarshall_rr(TALLOC_CTX *mem_ctx, if (!(ERR_DNS_IS_OK(buf->error))) return; if (r->data_length != 0) { - if (!(r->data = TALLOC_ARRAY(r, uint8, r->data_length))) { + if (!(r->data = talloc_array(r, uint8, r->data_length))) { buf->error = ERROR_DNS_NO_MEMORY; return; } @@ -406,22 +406,22 @@ DNS_ERROR dns_unmarshall_request(TALLOC_CTX *mem_ctx, err = ERROR_DNS_NO_MEMORY; if ((req->num_questions != 0) && - !(req->questions = TALLOC_ARRAY(req, struct dns_question *, + !(req->questions = talloc_array(req, struct dns_question *, req->num_questions))) { goto error; } if ((req->num_answers != 0) && - !(req->answers = TALLOC_ARRAY(req, struct dns_rrec *, + !(req->answers = talloc_array(req, struct dns_rrec *, req->num_answers))) { goto error; } if ((req->num_auths != 0) && - !(req->auths = TALLOC_ARRAY(req, struct dns_rrec *, + !(req->auths = talloc_array(req, struct dns_rrec *, req->num_auths))) { goto error; } if ((req->num_additionals != 0) && - !(req->additionals = TALLOC_ARRAY(req, struct dns_rrec *, + !(req->additionals = talloc_array(req, struct dns_rrec *, req->num_additionals))) { goto error; } diff --git a/lib/addns/dnsrecord.c b/lib/addns/dnsrecord.c index 52391aef78..2d0dc9ec5b 100644 --- a/lib/addns/dnsrecord.c +++ b/lib/addns/dnsrecord.c @@ -32,7 +32,7 @@ DNS_ERROR dns_create_query( TALLOC_CTX *mem_ctx, const char *name, DNS_ERROR err; if (!(req = TALLOC_ZERO_P(mem_ctx, struct dns_request)) || - !(req->questions = TALLOC_ARRAY(req, struct dns_question *, 1)) || + !(req->questions = talloc_array(req, struct dns_question *, 1)) || !(req->questions[0] = talloc(req->questions, struct dns_question))) { TALLOC_FREE(req); @@ -65,7 +65,7 @@ DNS_ERROR dns_create_update( TALLOC_CTX *mem_ctx, const char *name, DNS_ERROR err; if (!(req = TALLOC_ZERO_P(mem_ctx, struct dns_update_request)) || - !(req->zones = TALLOC_ARRAY(req, struct dns_zone *, 1)) || + !(req->zones = talloc_array(req, struct dns_zone *, 1)) || !(req->zones[0] = talloc(req->zones, struct dns_zone))) { TALLOC_FREE(req); return ERROR_DNS_NO_MEMORY; @@ -240,7 +240,7 @@ DNS_ERROR dns_unmarshall_tkey_record(TALLOC_CTX *mem_ctx, struct dns_rrec *rec, if (!ERR_DNS_IS_OK(buf.error)) goto error; if (tkey->key_length) { - if (!(tkey->key = TALLOC_ARRAY(tkey, uint8, tkey->key_length))) { + if (!(tkey->key = talloc_array(tkey, uint8, tkey->key_length))) { buf.error = ERROR_DNS_NO_MEMORY; goto error; } diff --git a/lib/addns/dnssock.c b/lib/addns/dnssock.c index 42b4e2d40f..da8a52100e 100644 --- a/lib/addns/dnssock.c +++ b/lib/addns/dnssock.c @@ -262,7 +262,7 @@ static DNS_ERROR dns_receive_tcp(TALLOC_CTX *mem_ctx, buf->size = ntohs(len); if (buf->size) { - if (!(buf->data = TALLOC_ARRAY(buf, uint8, buf->size))) { + if (!(buf->data = talloc_array(buf, uint8, buf->size))) { TALLOC_FREE(buf); return ERROR_DNS_NO_MEMORY; } @@ -295,7 +295,7 @@ static DNS_ERROR dns_receive_udp(TALLOC_CTX *mem_ctx, * UDP based DNS can only be 512 bytes */ - if (!(buf->data = TALLOC_ARRAY(buf, uint8, 512))) { + if (!(buf->data = talloc_array(buf, uint8, 512))) { TALLOC_FREE(buf); return ERROR_DNS_NO_MEMORY; } diff --git a/lib/addns/dnsutils.c b/lib/addns/dnsutils.c index 37b862c7f0..526179bee3 100644 --- a/lib/addns/dnsutils.c +++ b/lib/addns/dnsutils.c @@ -138,7 +138,7 @@ char *dns_generate_keyname( TALLOC_CTX *mem_ctx ) /* * uuid_unparse gives 36 bytes plus '\0' */ - if (!(result = TALLOC_ARRAY(mem_ctx, char, 37))) { + if (!(result = talloc_array(mem_ctx, char, 37))) { return NULL; } diff --git a/libgpo/gpo_ldap.c b/libgpo/gpo_ldap.c index 6abaf29cf0..debae53da1 100644 --- a/libgpo/gpo_ldap.c +++ b/libgpo/gpo_ldap.c @@ -640,7 +640,7 @@ ADS_STATUS ads_get_sid_token(ADS_STRUCT *ads, return status; } - token_sids = TALLOC_ARRAY(mem_ctx, struct dom_sid, 1); + token_sids = talloc_array(mem_ctx, struct dom_sid, 1); ADS_ERROR_HAVE_NO_MEMORY(token_sids); status = ADS_ERROR_NT(add_sid_to_array_unique(mem_ctx, diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c index 70d11239c9..25d84e9d86 100644 --- a/source3/auth/auth_util.c +++ b/source3/auth/auth_util.c @@ -519,7 +519,7 @@ NTSTATUS create_local_token(TALLOC_CTX *mem_ctx, t = session_info->security_token; - ids = TALLOC_ARRAY(talloc_tos(), struct wbcUnixId, + ids = talloc_array(talloc_tos(), struct wbcUnixId, t->num_sids); if (ids == NULL) { return NT_STATUS_NO_MEMORY; diff --git a/source3/auth/token_util.c b/source3/auth/token_util.c index ff55a671f3..386e667834 100644 --- a/source3/auth/token_util.c +++ b/source3/auth/token_util.c @@ -693,9 +693,9 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username, num_group_sids = getgroups_num_group_sids; if (num_group_sids) { - group_sids = TALLOC_ARRAY(tmp_ctx, struct dom_sid, num_group_sids); + group_sids = talloc_array(tmp_ctx, struct dom_sid, num_group_sids); if (group_sids == NULL) { - DEBUG(1, ("TALLOC_ARRAY failed\n")); + DEBUG(1, ("talloc_array failed\n")); result = NT_STATUS_NO_MEMORY; goto done; } @@ -732,9 +732,9 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username, } num_group_sids = 1; - group_sids = TALLOC_ARRAY(tmp_ctx, struct dom_sid, num_group_sids); + group_sids = talloc_array(tmp_ctx, struct dom_sid, num_group_sids); if (group_sids == NULL) { - DEBUG(1, ("TALLOC_ARRAY failed\n")); + DEBUG(1, ("talloc_array failed\n")); result = NT_STATUS_NO_MEMORY; goto done; } diff --git a/source3/client/dnsbrowse.c b/source3/client/dnsbrowse.c index c252b25343..03f87afe14 100644 --- a/source3/client/dnsbrowse.c +++ b/source3/client/dnsbrowse.c @@ -124,7 +124,7 @@ do_smb_browse_reply(DNSServiceRef sdRef, DNSServiceFlags flags, return; } - bresult = TALLOC_ARRAY(talloc_tos(), struct mdns_smbsrv_result, 1); + bresult = talloc_array(talloc_tos(), struct mdns_smbsrv_result, 1); if (bresult == NULL) { return; } diff --git a/source3/groupdb/mapping.c b/source3/groupdb/mapping.c index 04af27bcf3..e37c951237 100644 --- a/source3/groupdb/mapping.c +++ b/source3/groupdb/mapping.c @@ -635,7 +635,7 @@ NTSTATUS pdb_default_alias_memberships(struct pdb_methods *methods, return NT_STATUS_OK; } - *pp_alias_rids = TALLOC_ARRAY(mem_ctx, uint32, num_alias_sids); + *pp_alias_rids = talloc_array(mem_ctx, uint32, num_alias_sids); if (*pp_alias_rids == NULL) return NT_STATUS_NO_MEMORY; diff --git a/source3/groupdb/mapping_tdb.c b/source3/groupdb/mapping_tdb.c index 1a6d4e152f..cf8857cda5 100644 --- a/source3/groupdb/mapping_tdb.c +++ b/source3/groupdb/mapping_tdb.c @@ -145,7 +145,7 @@ static bool add_mapping_entry(GROUP_MAP *map, int flag) len = tdb_pack(NULL, 0, "ddff", map->gid, map->sid_name_use, map->nt_name, map->comment); - buf = TALLOC_ARRAY(key, char, len); + buf = talloc_array(key, char, len); if (!buf) { TALLOC_FREE(key); return false; diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h index cb364a9aa3..e21977f748 100644 --- a/source3/include/smb_macros.h +++ b/source3/include/smb_macros.h @@ -220,7 +220,6 @@ copy an IP address from one buffer to another #define TALLOC(ctx, size) talloc_named_const(ctx, size, __location__) #define TALLOC_P(ctx, type) (type *)talloc_named_const(ctx, sizeof(type), #type) -#define TALLOC_ARRAY(ctx, type, count) (type *)_talloc_array(ctx, sizeof(type), count, #type) #define TALLOC_MEMDUP(ctx, ptr, size) _talloc_memdup(ctx, ptr, size, __location__) #define TALLOC_ZERO(ctx, size) _talloc_zero(ctx, size, __location__) #define TALLOC_ZERO_P(ctx, type) (type *)_talloc_zero(ctx, sizeof(type), #type) diff --git a/source3/lib/dbwrap_file.c b/source3/lib/dbwrap_file.c index 69ad8e4b20..e195d6f6f3 100644 --- a/source3/lib/dbwrap_file.c +++ b/source3/lib/dbwrap_file.c @@ -168,7 +168,7 @@ static struct db_record *db_file_fetch_locked(struct db_context *db, if (statbuf.st_size != 0) { result->value.dsize = statbuf.st_size; - result->value.dptr = TALLOC_ARRAY(result, uint8, + result->value.dptr = talloc_array(result, uint8, statbuf.st_size); if (result->value.dptr == NULL) { DEBUG(1, ("talloc failed\n")); diff --git a/source3/lib/g_lock.c b/source3/lib/g_lock.c index c3d863f9a4..f2452919af 100644 --- a/source3/lib/g_lock.c +++ b/source3/lib/g_lock.c @@ -393,7 +393,7 @@ NTSTATUS g_lock_lock(struct g_lock_ctx *ctx, const char *name, * sys_poll and in the clustering case we might have to add * the ctdb fd. This avoids the realloc then. */ - pollfds = TALLOC_ARRAY(talloc_tos(), struct pollfd, 2); + pollfds = talloc_array(talloc_tos(), struct pollfd, 2); if (pollfds == NULL) { status = NT_STATUS_NO_MEMORY; break; diff --git a/source3/lib/netapi/user.c b/source3/lib/netapi/user.c index 28619a0e44..f1182100c7 100644 --- a/source3/lib/netapi/user.c +++ b/source3/lib/netapi/user.c @@ -3572,7 +3572,7 @@ WERROR NetUserGetLocalGroups_r(struct libnetapi_ctx *ctx, } sid_array.num_sids = rid_array->count + 1; - sid_array.sids = TALLOC_ARRAY(ctx, struct lsa_SidPtr, sid_array.num_sids); + sid_array.sids = talloc_array(ctx, struct lsa_SidPtr, sid_array.num_sids); if (!sid_array.sids) { werr = WERR_NOMEM; goto done; diff --git a/source3/lib/sharesec.c b/source3/lib/sharesec.c index c2494e2293..ed971a97a6 100644 --- a/source3/lib/sharesec.c +++ b/source3/lib/sharesec.c @@ -463,7 +463,7 @@ bool parse_usershare_acl(TALLOC_CTX *ctx, const char *acl_str, struct security_d /* Add the number of ',' characters to get the number of aces. */ num_aces += count_chars(pacl,','); - ace_list = TALLOC_ARRAY(ctx, struct security_ace, num_aces); + ace_list = talloc_array(ctx, struct security_ace, num_aces); if (!ace_list) { return False; } diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c index fe383663d7..1632cd2feb 100644 --- a/source3/lib/smbldap.c +++ b/source3/lib/smbldap.c @@ -239,7 +239,7 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = { i++; i++; - names = TALLOC_ARRAY( mem_ctx, const char*, i ); + names = talloc_array( mem_ctx, const char*, i ); if ( !names ) { DEBUG(0,("get_attr_list: out of memory\n")); return NULL; diff --git a/source3/lib/system.c b/source3/lib/system.c index a6f7de0af5..342a5ffaed 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -1382,7 +1382,7 @@ static char **extract_args(TALLOC_CTX *mem_ctx, const char *command) TALLOC_FREE(trunc_cmd); - if (!(argl = TALLOC_ARRAY(mem_ctx, char *, argcl + 1))) { + if (!(argl = talloc_array(mem_ctx, char *, argcl + 1))) { goto nomem; } diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index 6fe8f67448..a348b389e8 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -624,7 +624,7 @@ bool str_list_substitute(char **list, const char *pattern, const char *insert) t = *list; d = p -t; if (ld) { - t = TALLOC_ARRAY(ctx, char, ls +ld +1); + t = talloc_array(ctx, char, ls +ld +1); if (!t) { DEBUG(0,("str_list_substitute: " "Unable to allocate memory")); @@ -926,7 +926,7 @@ void sprintf_append(TALLOC_CTX *mem_ctx, char **string, ssize_t *len, if (*bufsize == 0) *bufsize = 128; - *string = TALLOC_ARRAY(mem_ctx, char, *bufsize); + *string = talloc_array(mem_ctx, char, *bufsize); if (*string == NULL) goto error; } @@ -1229,7 +1229,7 @@ char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, if (!string || !*string) return NULL; - list = TALLOC_ARRAY(mem_ctx, char *, S_LIST_ABS+1); + list = talloc_array(mem_ctx, char *, S_LIST_ABS+1); if (list == NULL) { return NULL; } diff --git a/source3/lib/winbind_util.c b/source3/lib/winbind_util.c index 3fa1485d45..b458ebe847 100644 --- a/source3/lib/winbind_util.c +++ b/source3/lib/winbind_util.c @@ -237,8 +237,8 @@ bool winbind_lookup_rids(TALLOC_CTX *mem_ctx, } *domain_name = talloc_strdup(mem_ctx, dom_name); - *names = TALLOC_ARRAY(mem_ctx, const char*, num_rids); - *types = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_rids); + *names = talloc_array(mem_ctx, const char*, num_rids); + *types = talloc_array(mem_ctx, enum lsa_SidType, num_rids); for(i=0; i<num_rids; i++) { (*names)[i] = talloc_strdup(*names, namelist[i]); @@ -284,7 +284,7 @@ bool winbind_get_groups(TALLOC_CTX * mem_ctx, const char *account, uint32_t *num if (ret != WBC_ERR_SUCCESS) return false; - *_groups = TALLOC_ARRAY(mem_ctx, gid_t, ngroups); + *_groups = talloc_array(mem_ctx, gid_t, ngroups); if (*_groups == NULL) { wbcFreeMemory(group_list); return false; @@ -313,7 +313,7 @@ bool winbind_get_sid_aliases(TALLOC_CTX *mem_ctx, memcpy(&domain_sid, dom_sid, sizeof(*dom_sid)); - sid_list = TALLOC_ARRAY(mem_ctx, struct wbcDomainSid, num_members); + sid_list = talloc_array(mem_ctx, struct wbcDomainSid, num_members); for (i=0; i < num_members; i++) { memcpy(&sid_list[i], &members[i], sizeof(sid_list[i])); @@ -328,7 +328,7 @@ bool winbind_get_sid_aliases(TALLOC_CTX *mem_ctx, return false; } - *pp_alias_rids = TALLOC_ARRAY(mem_ctx, uint32_t, num_rids); + *pp_alias_rids = talloc_array(mem_ctx, uint32_t, num_rids); if (*pp_alias_rids == NULL) { wbcFreeMemory(rids); return false; diff --git a/source3/libads/dns.c b/source3/libads/dns.c index 08180a65c0..c1332849bf 100644 --- a/source3/libads/dns.c +++ b/source3/libads/dns.c @@ -328,7 +328,7 @@ static NTSTATUS dns_send_req( TALLOC_CTX *ctx, const char *name, int q_type, buf_len = resp_len * sizeof(uint8); if (buf_len) { - if ((buffer = TALLOC_ARRAY(ctx, uint8, buf_len)) + if ((buffer = talloc_array(ctx, uint8, buf_len)) == NULL ) { DEBUG(0,("ads_dns_lookup_srv: " "talloc() failed!\n")); @@ -534,7 +534,7 @@ static NTSTATUS ads_dns_lookup_srv( TALLOC_CTX *ctx, /* allocate new memory */ if (dcs[i].num_ips == 0) { - if ((dcs[i].ss_s = TALLOC_ARRAY(dcs, + if ((dcs[i].ss_s = talloc_array(dcs, struct sockaddr_storage, 1 )) == NULL ) { return NT_STATUS_NO_MEMORY; @@ -638,7 +638,7 @@ NTSTATUS ads_dns_lookup_ns(TALLOC_CTX *ctx, answer_count)); if (answer_count) { - if ((nsarray = TALLOC_ARRAY(ctx, struct dns_rr_ns, + if ((nsarray = talloc_array(ctx, struct dns_rr_ns, answer_count)) == NULL ) { DEBUG(0,("ads_dns_lookup_ns: " "talloc() failure for %d char*'s\n", diff --git a/source3/libads/kerberos.c b/source3/libads/kerberos.c index 48a832e1a9..a41686a495 100644 --- a/source3/libads/kerberos.c +++ b/source3/libads/kerberos.c @@ -964,7 +964,7 @@ bool create_local_private_krb5_conf_for_domain(const char *realm, if (S_ISLNK(sbuf.st_ex_mode) && sbuf.st_ex_size) { int lret; size_t alloc_size = sbuf.st_ex_size + 1; - char *linkpath = TALLOC_ARRAY(talloc_tos(), char, + char *linkpath = talloc_array(talloc_tos(), char, alloc_size); if (!linkpath) { goto done; diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index f39e6ede5c..743bf42b1e 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -2433,7 +2433,7 @@ int ads_count_replies(ADS_STRUCT *ads, void *res) *num_values = ldap_count_values(values); - ret = TALLOC_ARRAY(mem_ctx, char *, *num_values + 1); + ret = talloc_array(mem_ctx, char *, *num_values + 1); if (!ret) { ldap_value_free(values); return NULL; @@ -2669,7 +2669,7 @@ int ads_count_replies(ADS_STRUCT *ads, void *res) /* nop */ ; if (i) { - (*sids) = TALLOC_ARRAY(mem_ctx, struct dom_sid, i); + (*sids) = talloc_array(mem_ctx, struct dom_sid, i); if (!(*sids)) { ldap_value_free_len(values); return 0; diff --git a/source3/libads/ldap_printer.c b/source3/libads/ldap_printer.c index 3e3ea25840..8ff9f9bdc9 100644 --- a/source3/libads/ldap_printer.c +++ b/source3/libads/ldap_printer.c @@ -199,7 +199,7 @@ static bool map_multi_sz(TALLOC_CTX *ctx, ADS_MODLIST *mods, }; if (num_vals) { - str_values = TALLOC_ARRAY(ctx, char *, num_vals + 1); + str_values = talloc_array(ctx, char *, num_vals + 1); if (!str_values) { return False; } diff --git a/source3/libads/ldap_schema.c b/source3/libads/ldap_schema.c index 51aac14906..df13b08f4a 100644 --- a/source3/libads/ldap_schema.c +++ b/source3/libads/ldap_schema.c @@ -76,11 +76,11 @@ static ADS_STATUS ads_get_attrnames_by_oids(ADS_STRUCT *ads, goto out; } - if (((*names) = TALLOC_ARRAY(mem_ctx, char *, *count)) == NULL) { + if (((*names) = talloc_array(mem_ctx, char *, *count)) == NULL) { status = ADS_ERROR(LDAP_NO_MEMORY); goto out; } - if (((*OIDs_out) = TALLOC_ARRAY(mem_ctx, char *, *count)) == NULL) { + if (((*OIDs_out) = talloc_array(mem_ctx, char *, *count)) == NULL) { status = ADS_ERROR(LDAP_NO_MEMORY); goto out; } diff --git a/source3/libads/ldap_utils.c b/source3/libads/ldap_utils.c index ab77abdd16..2f1c1b8e0a 100644 --- a/source3/libads/ldap_utils.c +++ b/source3/libads/ldap_utils.c @@ -242,7 +242,7 @@ ADS_STATUS ads_ranged_search(ADS_STRUCT *ads, *num_strings = 0; *strings = NULL; - attrs = TALLOC_ARRAY(mem_ctx, const char *, 3); + attrs = talloc_array(mem_ctx, const char *, 3); ADS_ERROR_HAVE_NO_MEMORY(attrs); attrs[0] = talloc_strdup(mem_ctx, range_attr); diff --git a/source3/libnet/libnet_dssync_keytab.c b/source3/libnet/libnet_dssync_keytab.c index 65085cd96e..6f3ed64226 100644 --- a/source3/libnet/libnet_dssync_keytab.c +++ b/source3/libnet/libnet_dssync_keytab.c @@ -276,7 +276,7 @@ static NTSTATUS parse_object(TALLOC_CTX *mem_ctx, if (attr->attid == DRSUAPI_ATTID_servicePrincipalName) { uint32_t count; num_spns = attr->value_ctr.num_values; - spn = TALLOC_ARRAY(mem_ctx, char *, num_spns); + spn = talloc_array(mem_ctx, char *, num_spns); for (count = 0; count < num_spns; count++) { blob = attr->value_ctr.values[count].blob; pull_string_talloc(spn, NULL, 0, diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 8b76e8f5d8..ad5685361b 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -3998,7 +3998,7 @@ static bool parse_ea_blob(TALLOC_CTX *ctx, const uint8_t *rdata, return true; } - ea_list = TALLOC_ARRAY(ctx, struct ea_struct, num_eas); + ea_list = talloc_array(ctx, struct ea_struct, num_eas); if (!ea_list) { return false; } diff --git a/source3/libsmb/clilist.c b/source3/libsmb/clilist.c index 83cc81549a..9eec97fbeb 100644 --- a/source3/libsmb/clilist.c +++ b/source3/libsmb/clilist.c @@ -452,7 +452,7 @@ static NTSTATUS cli_list_old_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, num_received = talloc_array_length(state->dirlist) / DIR_STRUCT_SIZE; - finfo = TALLOC_ARRAY(mem_ctx, struct file_info, num_received); + finfo = talloc_array(mem_ctx, struct file_info, num_received); if (finfo == NULL) { return NT_STATUS_NO_MEMORY; } @@ -573,7 +573,7 @@ static struct tevent_req *cli_list_trans_send(TALLOC_CTX *mem_ctx, state->setup[0] = TRANSACT2_FINDFIRST; nlen = 2*(strlen(mask)+1); - state->param = TALLOC_ARRAY(state, uint8_t, 12+nlen+2); + state->param = talloc_array(state, uint8_t, 12+nlen+2); if (tevent_req_nomem(state->param, req)) { return tevent_req_post(req, ev); } diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c index 008db0b65a..e5ff1abc18 100644 --- a/source3/libsmb/clirap.c +++ b/source3/libsmb/clirap.c @@ -1023,7 +1023,7 @@ static bool parse_streams_blob(TALLOC_CTX *mem_ctx, const uint8_t *rdata, * convert_string_talloc?? */ - tmp_buf = TALLOC_ARRAY(streams, uint8_t, nlen+2); + tmp_buf = talloc_array(streams, uint8_t, nlen+2); if (tmp_buf == NULL) { goto fail; } diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c index fc6c9ffc00..223309f756 100644 --- a/source3/libsmb/clireadwrite.c +++ b/source3/libsmb/clireadwrite.c @@ -704,7 +704,7 @@ NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf, * 3 bytes prefix */ - bytes = TALLOC_ARRAY(talloc_tos(), uint8_t, 3); + bytes = talloc_array(talloc_tos(), uint8_t, 3); if (bytes == NULL) { return NT_STATUS_NO_MEMORY; } diff --git a/source3/libsmb/clitrans.c b/source3/libsmb/clitrans.c index 44dafa7e43..99a358f81f 100644 --- a/source3/libsmb/clitrans.c +++ b/source3/libsmb/clitrans.c @@ -148,7 +148,7 @@ static NTSTATUS cli_trans_pull_blob(TALLOC_CTX *mem_ctx, return NT_STATUS_INVALID_NETWORK_RESPONSE; } blob->total = total; - blob->data = TALLOC_ARRAY(mem_ctx, uint8_t, total); + blob->data = talloc_array(mem_ctx, uint8_t, total); if (blob->data == NULL) { return NT_STATUS_NO_MEMORY; } diff --git a/source3/libsmb/libsmb_path.c b/source3/libsmb/libsmb_path.c index 64a956d9ee..1dcf2dd516 100644 --- a/source3/libsmb/libsmb_path.c +++ b/source3/libsmb/libsmb_path.c @@ -88,7 +88,7 @@ urldecode_talloc(TALLOC_CTX *ctx, char **pp_dest, const char *src) newlen++; } - dest = TALLOC_ARRAY(ctx, char, newlen); + dest = talloc_array(ctx, char, newlen); if (!dest) { return err_count; } diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c index eec42ff622..f5f4a7c1dc 100644 --- a/source3/libsmb/namequery.c +++ b/source3/libsmb/namequery.c @@ -237,7 +237,7 @@ static struct node_status *parse_node_status(TALLOC_CTX *mem_ctx, char *p, if (*num_names == 0) return NULL; - ret = TALLOC_ARRAY(mem_ctx, struct node_status,*num_names); + ret = talloc_array(mem_ctx, struct node_status,*num_names); if (!ret) return NULL; @@ -1117,7 +1117,7 @@ static int remove_duplicate_addrs2(struct ip_service *iplist, int count ) static bool prioritize_ipv4_list(struct ip_service *iplist, int count) { TALLOC_CTX *frame = talloc_stackframe(); - struct ip_service *iplist_new = TALLOC_ARRAY(frame, struct ip_service, count); + struct ip_service *iplist_new = talloc_array(frame, struct ip_service, count); int i, j; if (iplist_new == NULL) { @@ -2514,7 +2514,7 @@ NTSTATUS resolve_name_list(TALLOC_CTX *ctx, return NT_STATUS_BAD_NETWORK_NAME; } - *return_ss_arr = TALLOC_ARRAY(ctx, + *return_ss_arr = talloc_array(ctx, struct sockaddr_storage, num_entries); if (!(*return_ss_arr)) { diff --git a/source3/locking/locking.c b/source3/locking/locking.c index a4561f50d8..55412ec8b2 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -616,7 +616,7 @@ static int parse_delete_tokens_list(struct share_mode_lock *lck, } pdtl->delete_token->ngroups = token_len / sizeof(gid_t); - pdtl->delete_token->groups = TALLOC_ARRAY(pdtl->delete_token, gid_t, + pdtl->delete_token->groups = talloc_array(pdtl->delete_token, gid_t, pdtl->delete_token->ngroups); if (pdtl->delete_token->groups == NULL) { DEBUG(0,("parse_delete_tokens_list: talloc failed")); @@ -782,7 +782,7 @@ static TDB_DATA unparse_share_modes(const struct share_mode_lock *lck) sp_len + 1 + bn_len + 1 + sn_len + 1; - result.dptr = TALLOC_ARRAY(lck, uint8, result.dsize); + result.dptr = talloc_array(lck, uint8, result.dsize); if (result.dptr == NULL) { smb_panic("talloc failed"); @@ -1082,7 +1082,7 @@ bool rename_share_filename(struct messaging_context *msg_ctx, sn_len + 1; /* Set up the name changed message. */ - frm = TALLOC_ARRAY(lck, char, msg_len); + frm = talloc_array(lck, char, msg_len); if (!frm) { return False; } diff --git a/source3/locking/posix.c b/source3/locking/posix.c index 3f1aa6da57..2e590413f8 100644 --- a/source3/locking/posix.c +++ b/source3/locking/posix.c @@ -558,7 +558,7 @@ static void add_fd_to_close_entry(files_struct *fsp) SMB_ASSERT(rec != NULL); - new_data = TALLOC_ARRAY( + new_data = talloc_array( rec, uint8_t, rec->value.dsize + sizeof(fsp->fh->fd)); SMB_ASSERT(new_data != NULL); diff --git a/source3/modules/vfs_afsacl.c b/source3/modules/vfs_afsacl.c index 4fdfdd997c..658f3be179 100644 --- a/source3/modules/vfs_afsacl.c +++ b/source3/modules/vfs_afsacl.c @@ -605,7 +605,7 @@ static size_t afs_to_nt_acl_common(struct afs_acl *afs_acl, gid_to_sid(&group_sid, psbuf->st_ex_gid); if (afs_acl->num_aces) { - nt_ace_list = TALLOC_ARRAY(mem_ctx, struct security_ace, afs_acl->num_aces); + nt_ace_list = talloc_array(mem_ctx, struct security_ace, afs_acl->num_aces); if (nt_ace_list == NULL) return 0; diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index 7aab6c3973..15bebf6fea 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -75,7 +75,7 @@ static SMB_STRUCT_DIRENT *cap_readdir(vfs_handle_struct *handle, } DEBUG(3,("cap: cap_readdir: %s\n", newname)); newnamelen = strlen(newname)+1; - newdirent = (SMB_STRUCT_DIRENT *)TALLOC_ARRAY(talloc_tos(), + newdirent = (SMB_STRUCT_DIRENT *)talloc_array(talloc_tos(), char, sizeof(SMB_STRUCT_DIRENT)+ newnamelen); @@ -663,7 +663,7 @@ static char *capencode(TALLOC_CTX *ctx, const char *from) } len++; - to = TALLOC_ARRAY(ctx, char, len); + to = talloc_array(ctx, char, len); if (!to) { return NULL; } @@ -704,7 +704,7 @@ static char *capdecode(TALLOC_CTX *ctx, const char *from) } len++; - to = TALLOC_ARRAY(ctx, char, len); + to = talloc_array(ctx, char, len); if (!to) { return NULL; } diff --git a/source3/modules/vfs_expand_msdfs.c b/source3/modules/vfs_expand_msdfs.c index f1f82d243e..eb7c6fed6b 100644 --- a/source3/modules/vfs_expand_msdfs.c +++ b/source3/modules/vfs_expand_msdfs.c @@ -178,7 +178,7 @@ static int expand_msdfs_readlink(struct vfs_handle_struct *handle, { TALLOC_CTX *ctx = talloc_tos(); int result; - char *target = TALLOC_ARRAY(ctx, char, PATH_MAX+1); + char *target = talloc_array(ctx, char, PATH_MAX+1); size_t len; if (!target) { diff --git a/source3/modules/vfs_preopen.c b/source3/modules/vfs_preopen.c index b29a4c4351..3d7f6c1b03 100644 --- a/source3/modules/vfs_preopen.c +++ b/source3/modules/vfs_preopen.c @@ -193,7 +193,7 @@ static bool preopen_helper(int fd, size_t to_read) char *namebuf; void *readbuf; - namebuf = TALLOC_ARRAY(NULL, char, 1024); + namebuf = talloc_array(NULL, char, 1024); if (namebuf == NULL) { return false; } @@ -261,7 +261,7 @@ static NTSTATUS preopen_init_helpers(TALLOC_CTX *mem_ctx, size_t to_read, } result->num_helpers = num_helpers; - result->helpers = TALLOC_ARRAY(result, struct preopen_helper, + result->helpers = talloc_array(result, struct preopen_helper, num_helpers); if (result->helpers == NULL) { TALLOC_FREE(result); diff --git a/source3/modules/vfs_scannedonly.c b/source3/modules/vfs_scannedonly.c index 549eb304bd..a47d875b64 100644 --- a/source3/modules/vfs_scannedonly.c +++ b/source3/modules/vfs_scannedonly.c @@ -632,7 +632,7 @@ static SMB_STRUCT_DIRENT *scannedonly_readdir(vfs_handle_struct *handle, ctx,"%s %s",result->d_name, STRUCTSCANO(handle->data)->scanning_message); namelen = strlen(notify_name); - newdirent = (SMB_STRUCT_DIRENT *)TALLOC_ARRAY( + newdirent = (SMB_STRUCT_DIRENT *)talloc_array( ctx, char, sizeof(SMB_STRUCT_DIRENT) + namelen + 1); if (!newdirent) { return NULL; diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c index 12e3ab17e3..6ec25c45c1 100644 --- a/source3/nmbd/nmbd_packets.c +++ b/source3/nmbd/nmbd_packets.c @@ -1714,7 +1714,7 @@ static bool create_listen_pollfds(struct pollfd **pfds, return true; } - attrs = TALLOC_ARRAY(NULL, struct socket_attributes, count); + attrs = talloc_array(NULL, struct socket_attributes, count); if (fds == NULL) { DEBUG(1, ("create_listen_pollfds: malloc fail for attrs. " "size %d\n", count)); diff --git a/source3/passdb/lookup_sid.c b/source3/passdb/lookup_sid.c index 5cf391f11c..bb193f3cdd 100644 --- a/source3/passdb/lookup_sid.c +++ b/source3/passdb/lookup_sid.c @@ -483,7 +483,7 @@ static bool lookup_rids(TALLOC_CTX *mem_ctx, const struct dom_sid *domain_sid, if (num_rids) { *names = TALLOC_ZERO_ARRAY(mem_ctx, const char *, num_rids); - *types = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_rids); + *types = talloc_array(mem_ctx, enum lsa_SidType, num_rids); if ((*names == NULL) || (*types == NULL)) { return false; @@ -750,7 +750,7 @@ NTSTATUS lookup_sids(TALLOC_CTX *mem_ctx, int num_sids, } if (num_sids) { - name_infos = TALLOC_ARRAY(mem_ctx, struct lsa_name_info, num_sids); + name_infos = talloc_array(mem_ctx, struct lsa_name_info, num_sids); if (name_infos == NULL) { result = NT_STATUS_NO_MEMORY; goto fail; @@ -896,7 +896,7 @@ NTSTATUS lookup_sids(TALLOC_CTX *mem_ctx, int num_sids, } if (dom->num_idxs) { - if (!(rids = TALLOC_ARRAY(tmp_ctx, uint32, dom->num_idxs))) { + if (!(rids = talloc_array(tmp_ctx, uint32, dom->num_idxs))) { result = NT_STATUS_NO_MEMORY; goto fail; } @@ -1404,7 +1404,7 @@ bool sids_to_unix_ids(const struct dom_sid *sids, uint32_t num_sids, wbcErr err; bool ret = false; - wbc_sids = TALLOC_ARRAY(talloc_tos(), struct wbcDomainSid, num_sids); + wbc_sids = talloc_array(talloc_tos(), struct wbcDomainSid, num_sids); if (wbc_sids == NULL) { return false; } @@ -1455,7 +1455,7 @@ bool sids_to_unix_ids(const struct dom_sid *sids, uint32_t num_sids, if (num_not_cached == 0) { goto done; } - wbc_ids = TALLOC_ARRAY(talloc_tos(), struct wbcUnixId, num_not_cached); + wbc_ids = talloc_array(talloc_tos(), struct wbcUnixId, num_not_cached); if (wbc_ids == NULL) { goto fail; } diff --git a/source3/passdb/pdb_interface.c b/source3/passdb/pdb_interface.c index 36d5aaa01a..d6f791053d 100644 --- a/source3/passdb/pdb_interface.c +++ b/source3/passdb/pdb_interface.c @@ -1570,7 +1570,7 @@ static NTSTATUS pdb_default_enum_group_memberships(struct pdb_methods *methods, smb_panic("primary group missing"); } - *pp_sids = TALLOC_ARRAY(mem_ctx, struct dom_sid, *p_num_groups); + *pp_sids = talloc_array(mem_ctx, struct dom_sid, *p_num_groups); if (*pp_sids == NULL) { TALLOC_FREE(*pp_gids); diff --git a/source3/passdb/pdb_ipa.c b/source3/passdb/pdb_ipa.c index 5f89be7a29..556283dc6b 100644 --- a/source3/passdb/pdb_ipa.c +++ b/source3/passdb/pdb_ipa.c @@ -636,7 +636,7 @@ static NTSTATUS ipasam_enum_trusted_domains(struct pdb_methods *methods, } *num_domains = 0; - if (!(*domains = TALLOC_ARRAY(mem_ctx, struct pdb_trusted_domain *, 1))) { + if (!(*domains = talloc_array(mem_ctx, struct pdb_trusted_domain *, 1))) { DEBUG(1, ("talloc failed\n")); return NT_STATUS_NO_MEMORY; } @@ -684,7 +684,7 @@ static NTSTATUS ipasam_enum_trusteddoms(struct pdb_methods *methods, return NT_STATUS_OK; } - if (!(*domains = TALLOC_ARRAY(mem_ctx, struct trustdom_info *, + if (!(*domains = talloc_array(mem_ctx, struct trustdom_info *, *num_domains))) { DEBUG(1, ("talloc failed\n")); return NT_STATUS_NO_MEMORY; diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index c21b54f74d..8167e3799e 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -208,7 +208,7 @@ static NTSTATUS ldapsam_get_seq_num(struct pdb_methods *my_methods, time_t *seq_ if (mem_ctx == NULL) return NT_STATUS_NO_MEMORY; - if ((attrs = TALLOC_ARRAY(mem_ctx, const char *, 2)) == NULL) { + if ((attrs = talloc_array(mem_ctx, const char *, 2)) == NULL) { ntstatus = NT_STATUS_NO_MEMORY; goto done; } @@ -887,7 +887,7 @@ static bool init_sam_from_ldap(struct ldapsam_privates *ldap_state, if (pwHistLen > 0){ uint8 *pwhist = NULL; int i; - char *history_string = TALLOC_ARRAY(ctx, char, + char *history_string = talloc_array(ctx, char, MAX_PW_HISTORY_LEN*64); if (!history_string) { @@ -896,7 +896,7 @@ static bool init_sam_from_ldap(struct ldapsam_privates *ldap_state, pwHistLen = MIN(pwHistLen, MAX_PW_HISTORY_LEN); - pwhist = TALLOC_ARRAY(ctx, uint8, + pwhist = talloc_array(ctx, uint8, pwHistLen * PW_HISTORY_ENTRY_LEN); if (pwhist == NULL) { DEBUG(0, ("init_sam_from_ldap: talloc failed!\n")); @@ -4340,7 +4340,7 @@ static const char **talloc_attrs(TALLOC_CTX *mem_ctx, ...) num += 1; va_end(ap); - if ((result = TALLOC_ARRAY(mem_ctx, const char *, num+1)) == NULL) { + if ((result = talloc_array(mem_ctx, const char *, num+1)) == NULL) { return NULL; } @@ -6356,7 +6356,7 @@ static NTSTATUS ldapsam_enum_trusteddoms(struct pdb_methods *methods, } *num_domains = 0; - if (!(*domains = TALLOC_ARRAY(mem_ctx, struct trustdom_info *, 1))) { + if (!(*domains = talloc_array(mem_ctx, struct trustdom_info *, 1))) { DEBUG(1, ("talloc failed\n")); return NT_STATUS_NO_MEMORY; } diff --git a/source3/passdb/pdb_wbc_sam.c b/source3/passdb/pdb_wbc_sam.c index 64529c7896..91adc8108b 100644 --- a/source3/passdb/pdb_wbc_sam.c +++ b/source3/passdb/pdb_wbc_sam.c @@ -112,7 +112,7 @@ static NTSTATUS pdb_wbc_sam_enum_group_memberships(struct pdb_methods *methods, smb_panic("primary group missing"); } - *pp_sids = TALLOC_ARRAY(mem_ctx, struct dom_sid, *p_num_groups); + *pp_sids = talloc_array(mem_ctx, struct dom_sid, *p_num_groups); if (*pp_sids == NULL) { TALLOC_FREE(*pp_gids); diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c index 8d544f1240..a1337eac9d 100644 --- a/source3/passdb/secrets.c +++ b/source3/passdb/secrets.c @@ -459,7 +459,7 @@ NTSTATUS secrets_trusted_domains(TALLOC_CTX *mem_ctx, uint32 *num_domains, * exists */ - if (!(state.domains = TALLOC_ARRAY( + if (!(state.domains = talloc_array( mem_ctx, struct trustdom_info *, 1))) { return NT_STATUS_NO_MEMORY; } diff --git a/source3/printing/notify.c b/source3/printing/notify.c index 0c7236ef3b..9fd73e8707 100644 --- a/source3/printing/notify.c +++ b/source3/printing/notify.c @@ -650,7 +650,7 @@ static bool print_notify_pid_list(const char *printername, TALLOC_CTX *mem_ctx, num_pids = data.dsize / 8; if (num_pids) { - if ((pid_list = TALLOC_ARRAY(mem_ctx, pid_t, num_pids)) == NULL) { + if ((pid_list = talloc_array(mem_ctx, pid_t, num_pids)) == NULL) { ret = False; goto done; } diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c index 566ab0bc6b..05f3a5a0ab 100644 --- a/source3/registry/reg_backend_db.c +++ b/source3/registry/reg_backend_db.c @@ -1820,7 +1820,7 @@ static bool regdb_store_values_internal(struct db_context *db, const char *key, goto done; } - data.dptr = TALLOC_ARRAY(ctx, uint8, len); + data.dptr = talloc_array(ctx, uint8, len); data.dsize = len; len = regdb_pack_values(values, data.dptr, data.dsize); diff --git a/source3/registry/regfio.c b/source3/registry/regfio.c index 8715ab5673..925ff8775a 100644 --- a/source3/registry/regfio.c +++ b/source3/registry/regfio.c @@ -1926,7 +1926,7 @@ static int hashrec_cmp( REGF_HASH_REC *h1, REGF_HASH_REC *h2 ) nk->values_off = prs_offset( &vlist_hbin->ps ) + vlist_hbin->first_hbin_off - HBIN_HDR_SIZE; if (nk->num_values) { - if ( !(nk->values = TALLOC_ARRAY( file->mem_ctx, REGF_VK_REC, nk->num_values )) ) + if ( !(nk->values = talloc_array( file->mem_ctx, REGF_VK_REC, nk->num_values )) ) return NULL; } else { nk->values = NULL; diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c index e599571181..66192bdf54 100644 --- a/source3/rpc_client/cli_lsarpc.c +++ b/source3/rpc_client/cli_lsarpc.c @@ -187,7 +187,7 @@ static NTSTATUS dcerpc_lsa_lookup_sids_noalloc(struct dcerpc_binding_handle *h, ZERO_STRUCT(lsa_names); sid_array.num_sids = num_sids; - sid_array.sids = TALLOC_ARRAY(mem_ctx, struct lsa_SidPtr, num_sids); + sid_array.sids = talloc_array(mem_ctx, struct lsa_SidPtr, num_sids); if (sid_array.sids == NULL) { return NT_STATUS_NO_MEMORY; } @@ -354,19 +354,19 @@ static NTSTATUS dcerpc_lsa_lookup_sids_generic(struct dcerpc_binding_handle *h, bool have_unmapped = false; if (num_sids) { - if (!(domains = TALLOC_ARRAY(mem_ctx, char *, num_sids))) { + if (!(domains = talloc_array(mem_ctx, char *, num_sids))) { DEBUG(0, ("rpccli_lsa_lookup_sids(): out of memory\n")); status = NT_STATUS_NO_MEMORY; goto fail; } - if (!(names = TALLOC_ARRAY(mem_ctx, char *, num_sids))) { + if (!(names = talloc_array(mem_ctx, char *, num_sids))) { DEBUG(0, ("rpccli_lsa_lookup_sids(): out of memory\n")); status = NT_STATUS_NO_MEMORY; goto fail; } - if (!(types = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_sids))) { + if (!(types = talloc_array(mem_ctx, enum lsa_SidType, num_sids))) { DEBUG(0, ("rpccli_lsa_lookup_sids(): out of memory\n")); status = NT_STATUS_NO_MEMORY; goto fail; @@ -589,7 +589,7 @@ static NTSTATUS dcerpc_lsa_lookup_names_generic(struct dcerpc_binding_handle *h, ZERO_STRUCT(sid_array); ZERO_STRUCT(sid_array3); - lsa_names = TALLOC_ARRAY(mem_ctx, struct lsa_String, num_names); + lsa_names = talloc_array(mem_ctx, struct lsa_String, num_names); if (lsa_names == NULL) { return NT_STATUS_NO_MEMORY; } @@ -639,20 +639,20 @@ static NTSTATUS dcerpc_lsa_lookup_names_generic(struct dcerpc_binding_handle *h, } if (num_names) { - if (!((*sids = TALLOC_ARRAY(mem_ctx, struct dom_sid, num_names)))) { + if (!((*sids = talloc_array(mem_ctx, struct dom_sid, num_names)))) { DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n")); *presult = NT_STATUS_NO_MEMORY; goto done; } - if (!((*types = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_names)))) { + if (!((*types = talloc_array(mem_ctx, enum lsa_SidType, num_names)))) { DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n")); *presult = NT_STATUS_NO_MEMORY; goto done; } if (dom_names != NULL) { - *dom_names = TALLOC_ARRAY(mem_ctx, const char *, num_names); + *dom_names = talloc_array(mem_ctx, const char *, num_names); if (*dom_names == NULL) { DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n")); *presult = NT_STATUS_NO_MEMORY; diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c index dcdf1f5a24..76d2cf164b 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/rpc_client/cli_pipe.c @@ -606,7 +606,7 @@ static void cli_api_pipe_write_done(struct tevent_req *subreq) return; } - state->rdata = TALLOC_ARRAY(state, uint8_t, RPC_HEADER_LEN); + state->rdata = talloc_array(state, uint8_t, RPC_HEADER_LEN); if (tevent_req_nomem(state->rdata, req)) { return; } @@ -2565,7 +2565,7 @@ static NTSTATUS rpc_pipe_get_tcp_port(const char *host, /* allocate further parameters for the epm_Map call */ - res_towers = TALLOC_ARRAY(tmp_ctx, struct epm_twr_t, max_towers); + res_towers = talloc_array(tmp_ctx, struct epm_twr_t, max_towers); if (res_towers == NULL) { status = NT_STATUS_NO_MEMORY; goto done; diff --git a/source3/rpc_server/dfs/srv_dfs_nt.c b/source3/rpc_server/dfs/srv_dfs_nt.c index 6ca35a5dcc..723760d601 100644 --- a/source3/rpc_server/dfs/srv_dfs_nt.c +++ b/source3/rpc_server/dfs/srv_dfs_nt.c @@ -88,7 +88,7 @@ WERROR _dfs_Add(struct pipes_struct *p, struct dfs_Add *r) return WERR_NOMEM; } - jn->referral_list = TALLOC_ARRAY(ctx, struct referral, jn->referral_count); + jn->referral_list = talloc_array(ctx, struct referral, jn->referral_count); if(jn->referral_list == NULL) { DEBUG(0,("init_reply_dfs_add: talloc failed for referral list!\n")); return WERR_DFS_INTERNAL_ERROR; @@ -233,7 +233,7 @@ static bool init_reply_dfs_info_3(TALLOC_CTX *mem_ctx, struct junction_map* j, s /* also enumerate the stores */ if (j->referral_count) { - dfs3->stores = TALLOC_ARRAY(mem_ctx, struct dfs_StorageInfo, j->referral_count); + dfs3->stores = talloc_array(mem_ctx, struct dfs_StorageInfo, j->referral_count); if (!dfs3->stores) return False; memset(dfs3->stores, '\0', j->referral_count * sizeof(struct dfs_StorageInfo)); @@ -295,7 +295,7 @@ WERROR _dfs_Enum(struct pipes_struct *p, struct dfs_Enum *r) switch (r->in.level) { case 1: if (num_jn) { - if ((r->out.info->e.info1->s = TALLOC_ARRAY(ctx, struct dfs_Info1, num_jn)) == NULL) { + if ((r->out.info->e.info1->s = talloc_array(ctx, struct dfs_Info1, num_jn)) == NULL) { return WERR_NOMEM; } } else { @@ -305,7 +305,7 @@ WERROR _dfs_Enum(struct pipes_struct *p, struct dfs_Enum *r) break; case 2: if (num_jn) { - if ((r->out.info->e.info2->s = TALLOC_ARRAY(ctx, struct dfs_Info2, num_jn)) == NULL) { + if ((r->out.info->e.info2->s = talloc_array(ctx, struct dfs_Info2, num_jn)) == NULL) { return WERR_NOMEM; } } else { @@ -315,7 +315,7 @@ WERROR _dfs_Enum(struct pipes_struct *p, struct dfs_Enum *r) break; case 3: if (num_jn) { - if ((r->out.info->e.info3->s = TALLOC_ARRAY(ctx, struct dfs_Info3, num_jn)) == NULL) { + if ((r->out.info->e.info3->s = talloc_array(ctx, struct dfs_Info3, num_jn)) == NULL) { return WERR_NOMEM; } } else { diff --git a/source3/rpc_server/echo/srv_echo_nt.c b/source3/rpc_server/echo/srv_echo_nt.c index c7a9e1a97d..7c8ae19b82 100644 --- a/source3/rpc_server/echo/srv_echo_nt.c +++ b/source3/rpc_server/echo/srv_echo_nt.c @@ -48,7 +48,7 @@ void _echo_EchoData(struct pipes_struct *p, struct echo_EchoData *r) return; } - r->out.out_data = TALLOC_ARRAY(p->mem_ctx, uint8, r->in.len); + r->out.out_data = talloc_array(p->mem_ctx, uint8, r->in.len); memcpy( r->out.out_data, r->in.in_data, r->in.len ); return; } @@ -76,7 +76,7 @@ void _echo_SourceData(struct pipes_struct *p, struct echo_SourceData *r) return; } - r->out.data = TALLOC_ARRAY(p->mem_ctx, uint8, r->in.len ); + r->out.data = talloc_array(p->mem_ctx, uint8, r->in.len ); for (i = 0; i < r->in.len; i++ ) { r->out.data[i] = i & 0xff; diff --git a/source3/rpc_server/lsa/srv_lsa_nt.c b/source3/rpc_server/lsa/srv_lsa_nt.c index 393dc31454..a120c6e7fe 100644 --- a/source3/rpc_server/lsa/srv_lsa_nt.c +++ b/source3/rpc_server/lsa/srv_lsa_nt.c @@ -858,7 +858,7 @@ static NTSTATUS _lsa_lookup_sids_internal(struct pipes_struct *p, return NT_STATUS_OK; } - sids = TALLOC_ARRAY(p->mem_ctx, const struct dom_sid *, num_sids); + sids = talloc_array(p->mem_ctx, const struct dom_sid *, num_sids); ref = TALLOC_ZERO_P(p->mem_ctx, struct lsa_RefDomainList); if (sids == NULL || ref == NULL) { @@ -876,7 +876,7 @@ static NTSTATUS _lsa_lookup_sids_internal(struct pipes_struct *p, return status; } - names = TALLOC_ARRAY(p->mem_ctx, struct lsa_TranslatedName2, num_sids); + names = talloc_array(p->mem_ctx, struct lsa_TranslatedName2, num_sids); if (names == NULL) { return NT_STATUS_NO_MEMORY; } @@ -998,7 +998,7 @@ NTSTATUS _lsa_LookupSids(struct pipes_struct *p, } /* Convert from lsa_TranslatedName2 to lsa_TranslatedName */ - names_out = TALLOC_ARRAY(p->mem_ctx, struct lsa_TranslatedName, + names_out = talloc_array(p->mem_ctx, struct lsa_TranslatedName, num_sids); if (!names_out) { return NT_STATUS_NO_MEMORY; @@ -1257,7 +1257,7 @@ NTSTATUS _lsa_LookupNames2(struct pipes_struct *p, status = _lsa_LookupNames(p, &q); sid_array2->count = sid_array->count; - sid_array2->sids = TALLOC_ARRAY(p->mem_ctx, struct lsa_TranslatedSid2, sid_array->count); + sid_array2->sids = talloc_array(p->mem_ctx, struct lsa_TranslatedSid2, sid_array->count); if (!sid_array2->sids) { return NT_STATUS_NO_MEMORY; } diff --git a/source3/rpc_server/samr/srv_samr_nt.c b/source3/rpc_server/samr/srv_samr_nt.c index 41e684d63d..186526edfc 100644 --- a/source3/rpc_server/samr/srv_samr_nt.c +++ b/source3/rpc_server/samr/srv_samr_nt.c @@ -5298,7 +5298,7 @@ NTSTATUS _samr_GetAliasMembership(struct pipes_struct *p, return NT_STATUS_OBJECT_TYPE_MISMATCH; if (r->in.sids->num_sids) { - members = TALLOC_ARRAY(p->mem_ctx, struct dom_sid, r->in.sids->num_sids); + members = talloc_array(p->mem_ctx, struct dom_sid, r->in.sids->num_sids); if (members == NULL) return NT_STATUS_NO_MEMORY; diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index 6b037232a6..f397333b4e 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -6924,7 +6924,7 @@ static WERROR enumjobs_level1(TALLOC_CTX *mem_ctx, int i; WERROR result = WERR_OK; - info = TALLOC_ARRAY(mem_ctx, union spoolss_JobInfo, num_queues); + info = talloc_array(mem_ctx, union spoolss_JobInfo, num_queues); W_ERROR_HAVE_NO_MEMORY(info); *count = num_queues; @@ -6968,7 +6968,7 @@ static WERROR enumjobs_level2(TALLOC_CTX *mem_ctx, int i; WERROR result = WERR_OK; - info = TALLOC_ARRAY(mem_ctx, union spoolss_JobInfo, num_queues); + info = talloc_array(mem_ctx, union spoolss_JobInfo, num_queues); W_ERROR_HAVE_NO_MEMORY(info); *count = num_queues; @@ -7023,7 +7023,7 @@ static WERROR enumjobs_level3(TALLOC_CTX *mem_ctx, int i; WERROR result = WERR_OK; - info = TALLOC_ARRAY(mem_ctx, union spoolss_JobInfo, num_queues); + info = talloc_array(mem_ctx, union spoolss_JobInfo, num_queues); W_ERROR_HAVE_NO_MEMORY(info); *count = num_queues; @@ -7632,7 +7632,7 @@ static WERROR enumports_hook(TALLOC_CTX *ctx, int *count, char ***lines) /* if no hook then just fill in the default port */ if ( !*cmd ) { - if (!(qlines = TALLOC_ARRAY( NULL, char*, 2 ))) { + if (!(qlines = talloc_array( NULL, char*, 2 ))) { return WERR_NOMEM; } if (!(qlines[0] = talloc_strdup(qlines, SAMBA_PRINTER_PORT_NAME ))) { @@ -7693,7 +7693,7 @@ static WERROR enumports_level_1(TALLOC_CTX *mem_ctx, } if (numlines) { - info = TALLOC_ARRAY(mem_ctx, union spoolss_PortInfo, numlines); + info = talloc_array(mem_ctx, union spoolss_PortInfo, numlines); if (!info) { DEBUG(10,("Returning WERR_NOMEM\n")); result = WERR_NOMEM; @@ -7745,7 +7745,7 @@ static WERROR enumports_level_2(TALLOC_CTX *mem_ctx, } if (numlines) { - info = TALLOC_ARRAY(mem_ctx, union spoolss_PortInfo, numlines); + info = talloc_array(mem_ctx, union spoolss_PortInfo, numlines); if (!info) { DEBUG(10,("Returning WERR_NOMEM\n")); result = WERR_NOMEM; @@ -8672,7 +8672,7 @@ static WERROR enumprintprocessors_level_1(TALLOC_CTX *mem_ctx, union spoolss_PrintProcessorInfo *info; WERROR result; - info = TALLOC_ARRAY(mem_ctx, union spoolss_PrintProcessorInfo, 1); + info = talloc_array(mem_ctx, union spoolss_PrintProcessorInfo, 1); W_ERROR_HAVE_NO_MEMORY(info); *count = 1; @@ -8774,7 +8774,7 @@ static WERROR enumprintprocdatatypes_level_1(TALLOC_CTX *mem_ctx, WERROR result; union spoolss_PrintProcDataTypesInfo *info; - info = TALLOC_ARRAY(mem_ctx, union spoolss_PrintProcDataTypesInfo, 1); + info = talloc_array(mem_ctx, union spoolss_PrintProcDataTypesInfo, 1); W_ERROR_HAVE_NO_MEMORY(info); *count = 1; @@ -8890,7 +8890,7 @@ static WERROR enumprintmonitors_level_1(TALLOC_CTX *mem_ctx, union spoolss_MonitorInfo *info; WERROR result = WERR_OK; - info = TALLOC_ARRAY(mem_ctx, union spoolss_MonitorInfo, 2); + info = talloc_array(mem_ctx, union spoolss_MonitorInfo, 2); W_ERROR_HAVE_NO_MEMORY(info); *count = 2; @@ -8930,7 +8930,7 @@ static WERROR enumprintmonitors_level_2(TALLOC_CTX *mem_ctx, union spoolss_MonitorInfo *info; WERROR result = WERR_OK; - info = TALLOC_ARRAY(mem_ctx, union spoolss_MonitorInfo, 2); + info = talloc_array(mem_ctx, union spoolss_MonitorInfo, 2); W_ERROR_HAVE_NO_MEMORY(info); *count = 2; diff --git a/source3/rpc_server/spoolss/srv_spoolss_util.c b/source3/rpc_server/spoolss/srv_spoolss_util.c index c8e96e077d..8505c8ffb5 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_util.c +++ b/source3/rpc_server/spoolss/srv_spoolss_util.c @@ -449,7 +449,7 @@ static WERROR winreg_printer_enumvalues(TALLOC_CTX *mem_ctx, return WERR_OK; } - enum_values = TALLOC_ARRAY(tmp_ctx, struct spoolss_PrinterEnumValues, num_values); + enum_values = talloc_array(tmp_ctx, struct spoolss_PrinterEnumValues, num_values); if (enum_values == NULL) { result = WERR_NOMEM; goto error; @@ -3084,7 +3084,7 @@ WERROR winreg_printer_enumforms1(TALLOC_CTX *mem_ctx, goto done; } - info = TALLOC_ARRAY(tmp_ctx, union spoolss_FormInfo, num_builtin + num_values); + info = talloc_array(tmp_ctx, union spoolss_FormInfo, num_builtin + num_values); if (info == NULL) { result = WERR_NOMEM; goto done; diff --git a/source3/rpc_server/svcctl/srv_svcctl_nt.c b/source3/rpc_server/svcctl/srv_svcctl_nt.c index bf7ade8be6..b2b8a1923d 100644 --- a/source3/rpc_server/svcctl/srv_svcctl_nt.c +++ b/source3/rpc_server/svcctl/srv_svcctl_nt.c @@ -71,7 +71,7 @@ bool init_service_op_table( void ) int num_services = SVCCTL_NUM_INTERNAL_SERVICES + str_list_length( service_list ); int i; - if ( !(svcctl_ops = TALLOC_ARRAY( NULL, struct service_control_op, num_services+1)) ) { + if ( !(svcctl_ops = talloc_array( NULL, struct service_control_op, num_services+1)) ) { DEBUG(0,("init_service_op_table: talloc() failed!\n")); return False; } @@ -421,7 +421,7 @@ static int enumerate_status(TALLOC_CTX *ctx, while ( svcctl_ops[num_services].name ) num_services++; - if ( !(st = TALLOC_ARRAY( ctx, struct ENUM_SERVICE_STATUSW, num_services )) ) { + if ( !(st = talloc_array( ctx, struct ENUM_SERVICE_STATUSW, num_services )) ) { DEBUG(0,("enumerate_status: talloc() failed!\n")); return -1; } diff --git a/source3/rpc_server/winreg/srv_winreg_nt.c b/source3/rpc_server/winreg/srv_winreg_nt.c index 6f319e9905..6fee5b6acd 100644 --- a/source3/rpc_server/winreg/srv_winreg_nt.c +++ b/source3/rpc_server/winreg/srv_winreg_nt.c @@ -542,7 +542,7 @@ WERROR _winreg_InitiateSystemShutdownEx(struct pipes_struct *p, if ( (msg = talloc_strdup(p->mem_ctx, r->in.message->string )) == NULL ) { return WERR_NOMEM; } - chkmsg = TALLOC_ARRAY(p->mem_ctx, char, strlen(msg)+1); + chkmsg = talloc_array(p->mem_ctx, char, strlen(msg)+1); if (!chkmsg) { return WERR_NOMEM; } diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c index cda25378ee..3382eb1a5c 100644 --- a/source3/rpcclient/cmd_lsarpc.c +++ b/source3/rpcclient/cmd_lsarpc.c @@ -400,7 +400,7 @@ static NTSTATUS cmd_lsa_lookup_sids(struct rpc_pipe_client *cli, TALLOC_CTX *mem /* Convert arguments to sids */ - sids = TALLOC_ARRAY(mem_ctx, struct dom_sid, argc - 1); + sids = talloc_array(mem_ctx, struct dom_sid, argc - 1); if (!sids) { printf("could not allocate memory for %d sids\n", argc - 1); @@ -978,7 +978,7 @@ static NTSTATUS cmd_lsa_add_acct_rights(struct rpc_pipe_client *cli, goto done; rights.count = argc-2; - rights.names = TALLOC_ARRAY(mem_ctx, struct lsa_StringLarge, + rights.names = talloc_array(mem_ctx, struct lsa_StringLarge, rights.count); if (!rights.names) { return NT_STATUS_NO_MEMORY; @@ -1036,7 +1036,7 @@ static NTSTATUS cmd_lsa_remove_acct_rights(struct rpc_pipe_client *cli, goto done; rights.count = argc-2; - rights.names = TALLOC_ARRAY(mem_ctx, struct lsa_StringLarge, + rights.names = talloc_array(mem_ctx, struct lsa_StringLarge, rights.count); if (!rights.names) { return NT_STATUS_NO_MEMORY; diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c index f135b1e86c..bcf4d5830d 100644 --- a/source3/rpcclient/cmd_samr.c +++ b/source3/rpcclient/cmd_samr.c @@ -2087,7 +2087,7 @@ static NTSTATUS cmd_samr_lookup_names(struct rpc_pipe_client *cli, num_names = argc - 2; - if ((names = TALLOC_ARRAY(mem_ctx, struct lsa_String, num_names)) == NULL) { + if ((names = talloc_array(mem_ctx, struct lsa_String, num_names)) == NULL) { dcerpc_samr_Close(b, mem_ctx, &domain_pol, &result); dcerpc_samr_Close(b, mem_ctx, &connect_pol, &result); status = NT_STATUS_NO_MEMORY; @@ -2167,7 +2167,7 @@ static NTSTATUS cmd_samr_lookup_rids(struct rpc_pipe_client *cli, num_rids = argc - 2; - if ((rids = TALLOC_ARRAY(mem_ctx, uint32, num_rids)) == NULL) { + if ((rids = talloc_array(mem_ctx, uint32, num_rids)) == NULL) { dcerpc_samr_Close(b, mem_ctx, &domain_pol, &result); dcerpc_samr_Close(b, mem_ctx, &connect_pol, &result); status = NT_STATUS_NO_MEMORY; diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c index aee6f58fff..b452000e13 100644 --- a/source3/smbd/ipc.c +++ b/source3/smbd/ipc.c @@ -742,7 +742,7 @@ void reply_trans(struct smb_request *req) goto bad_param; } - if((state->setup = TALLOC_ARRAY( + if((state->setup = talloc_array( state, uint16, state->setup_count)) == NULL) { DEBUG(0,("reply_trans: setup malloc fail for %u " "bytes !\n", (unsigned int) diff --git a/source3/smbd/msdfs.c b/source3/smbd/msdfs.c index 085834b4ee..1d296e342d 100644 --- a/source3/smbd/msdfs.c +++ b/source3/smbd/msdfs.c @@ -364,7 +364,7 @@ static bool parse_msdfs_symlink(TALLOC_CTX *ctx, return False; } - alt_path = TALLOC_ARRAY(ctx, char *, MAX_REFERRAL_COUNT); + alt_path = talloc_array(ctx, char *, MAX_REFERRAL_COUNT); if (!alt_path) { return False; } @@ -443,7 +443,7 @@ static bool is_msdfs_link_internal(TALLOC_CTX *ctx, if (pp_link_target) { bufsize = 1024; - link_target = TALLOC_ARRAY(ctx, char, bufsize); + link_target = talloc_array(ctx, char, bufsize); if (!link_target) { return False; } @@ -1736,7 +1736,7 @@ struct junction_map *enum_msdfs_links(struct smbd_server_connection *sconn, if (jn_count == 0) { return NULL; } - jn = TALLOC_ARRAY(ctx, struct junction_map, jn_count); + jn = talloc_array(ctx, struct junction_map, jn_count); if (!jn) { return NULL; } diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 06de8ab432..ee7b2ad6d2 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -3124,7 +3124,7 @@ NTSTATUS open_streams_for_delete(connection_struct *conn, return NT_STATUS_OK; } - streams = TALLOC_ARRAY(talloc_tos(), files_struct *, num_streams); + streams = talloc_array(talloc_tos(), files_struct *, num_streams); if (streams == NULL) { DEBUG(0, ("talloc failed\n")); status = NT_STATUS_NO_MEMORY; @@ -3637,7 +3637,7 @@ NTSTATUS get_relative_fid_filename(connection_struct *conn, * Copy in the base directory name. */ - parent_fname = TALLOC_ARRAY(talloc_tos(), char, + parent_fname = talloc_array(talloc_tos(), char, dir_name_len+2); if (parent_fname == NULL) { status = NT_STATUS_NO_MEMORY; diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index 02eb3361b8..8482a00f64 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -224,7 +224,7 @@ bool should_notify_deferred_opens() static char *new_break_message_smb1(TALLOC_CTX *mem_ctx, files_struct *fsp, int cmd) { - char *result = TALLOC_ARRAY(mem_ctx, char, smb_size + 8*2 + 0); + char *result = talloc_array(mem_ctx, char, smb_size + 8*2 + 0); if (result == NULL) { DEBUG(0, ("talloc failed\n")); diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 01200660fa..2b8521d54a 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -346,7 +346,7 @@ static NTSTATUS receive_smb_raw_talloc_partial_read(TALLOC_CTX *mem_ctx, * talloc and return. */ - *buffer = TALLOC_ARRAY(mem_ctx, char, len+4); + *buffer = talloc_array(mem_ctx, char, len+4); if (*buffer == NULL) { DEBUG(0, ("Could not allocate inbuf of length %d\n", @@ -415,7 +415,7 @@ static NTSTATUS receive_smb_raw_talloc(TALLOC_CTX *mem_ctx, * The +4 here can't wrap, we've checked the length above already. */ - *buffer = TALLOC_ARRAY(mem_ctx, char, len+4); + *buffer = talloc_array(mem_ctx, char, len+4); if (*buffer == NULL) { DEBUG(0, ("Could not allocate inbuf of length %d\n", @@ -1356,7 +1356,7 @@ static bool create_outbuf(TALLOC_CTX *mem_ctx, struct smb_request *req, smb_panic(msg); } - *outbuf = TALLOC_ARRAY(mem_ctx, char, + *outbuf = talloc_array(mem_ctx, char, smb_size + num_words*2 + num_bytes); if (*outbuf == NULL) { return false; diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 61e3a7e2d0..1980f757fd 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -3094,9 +3094,9 @@ static void send_file_readbraw(connection_struct *conn, normal_readbraw: - outbuf = TALLOC_ARRAY(NULL, char, nread+4); + outbuf = talloc_array(NULL, char, nread+4); if (!outbuf) { - DEBUG(0,("send_file_readbraw: TALLOC_ARRAY failed for size %u.\n", + DEBUG(0,("send_file_readbraw: talloc_array failed for size %u.\n", (unsigned)(nread+4))); reply_readbraw_error(sconn); return; @@ -4018,7 +4018,7 @@ void reply_writebraw(struct smb_request *req) total_written = nwritten; /* Allocate a buffer of 64k + length. */ - buf = TALLOC_ARRAY(NULL, char, 65540); + buf = talloc_array(NULL, char, 65540); if (!buf) { reply_nterror(req, NT_STATUS_NO_MEMORY); error_to_writebrawerr(req); diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 72907c5d3a..b9a4d4624b 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -192,7 +192,7 @@ NTSTATUS get_ea_names_from_file(TALLOC_CTX *mem_ctx, connection_struct *conn, * TALLOC the result early to get the talloc hierarchy right. */ - names = TALLOC_ARRAY(mem_ctx, char *, 1); + names = talloc_array(mem_ctx, char *, 1); if (names == NULL) { DEBUG(0, ("talloc failed\n")); return NT_STATUS_NO_MEMORY; @@ -4768,7 +4768,7 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn, case SMB_QUERY_FILE_UNIX_LINK: { int len; - char *buffer = TALLOC_ARRAY(mem_ctx, char, PATH_MAX+1); + char *buffer = talloc_array(mem_ctx, char, PATH_MAX+1); if (!buffer) { return NT_STATUS_NO_MEMORY; diff --git a/source3/torture/cmd_vfs.c b/source3/torture/cmd_vfs.c index c73bf6f36b..9527a34af4 100644 --- a/source3/torture/cmd_vfs.c +++ b/source3/torture/cmd_vfs.c @@ -57,7 +57,7 @@ static NTSTATUS cmd_populate(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int arg } c = argv[1][0]; size = atoi(argv[2]); - vfs->data = TALLOC_ARRAY(mem_ctx, char, size); + vfs->data = talloc_array(mem_ctx, char, size); if (vfs->data == NULL) { printf("populate: error=-1 (not enough memory)"); return NT_STATUS_UNSUCCESSFUL; @@ -435,7 +435,7 @@ static NTSTATUS cmd_read(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int argc, c /* do some error checking on these */ fd = atoi(argv[1]); size = atoi(argv[2]); - vfs->data = TALLOC_ARRAY(mem_ctx, char, size); + vfs->data = talloc_array(mem_ctx, char, size); if (vfs->data == NULL) { printf("read: error=-1 (not enough memory)"); return NT_STATUS_UNSUCCESSFUL; diff --git a/source3/torture/masktest.c b/source3/torture/masktest.c index 6eca1da693..9bb34dfe45 100644 --- a/source3/torture/masktest.c +++ b/source3/torture/masktest.c @@ -386,8 +386,8 @@ static void test_mask(int argc, char *argv[], while (1) { l1 = 1 + random() % 20; l2 = 1 + random() % 20; - mask = TALLOC_ARRAY(ctx, char, strlen("\\masktest\\")+1+22); - file = TALLOC_ARRAY(ctx, char, strlen("\\masktest\\")+1+22); + mask = talloc_array(ctx, char, strlen("\\masktest\\")+1+22); + file = talloc_array(ctx, char, strlen("\\masktest\\")+1+22); if (!mask || !file) { goto finished; } diff --git a/source3/torture/torture.c b/source3/torture/torture.c index 47f4efd5d8..0904f24356 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -8204,7 +8204,7 @@ static bool run_local_wbclient(int dummy) goto fail; } - wb_ctx = TALLOC_ARRAY(ev, struct wb_context *, nprocs); + wb_ctx = talloc_array(ev, struct wb_context *, nprocs); if (wb_ctx == NULL) { goto fail; } diff --git a/source3/utils/eventlogadm.c b/source3/utils/eventlogadm.c index a157e91e5c..d170604a1b 100644 --- a/source3/utils/eventlogadm.c +++ b/source3/utils/eventlogadm.c @@ -171,7 +171,7 @@ static bool eventlog_add_source( const char *eventlog, const char *sourcename, if ( !already_in ) { /* make a new list with an additional entry; copy values, add another */ - wp = TALLOC_ARRAY(ctx, const char *, numsources + 2 ); + wp = talloc_array(ctx, const char *, numsources + 2 ); if ( !wp ) { d_printf("talloc() failed \n"); diff --git a/source3/utils/net_rpc_registry.c b/source3/utils/net_rpc_registry.c index 20a6bdaa24..77b15a45c7 100644 --- a/source3/utils/net_rpc_registry.c +++ b/source3/utils/net_rpc_registry.c @@ -333,8 +333,8 @@ static NTSTATUS registry_enumvalues(TALLOC_CTX *ctx, return NT_STATUS_OK; } - if ((!(names = TALLOC_ARRAY(mem_ctx, char *, num_values))) || - (!(values = TALLOC_ARRAY(mem_ctx, struct registry_value *, + if ((!(names = talloc_array(mem_ctx, char *, num_values))) || + (!(values = talloc_array(mem_ctx, struct registry_value *, num_values)))) { status = NT_STATUS_NO_MEMORY; goto error; @@ -456,8 +456,8 @@ static NTSTATUS registry_enumvalues2(TALLOC_CTX *ctx, return NT_STATUS_OK; } - if ((!(names = TALLOC_ARRAY(mem_ctx, char *, num_values))) || - (!(values = TALLOC_ARRAY(mem_ctx, struct regval_blob *, + if ((!(names = talloc_array(mem_ctx, char *, num_values))) || + (!(values = talloc_array(mem_ctx, struct regval_blob *, num_values)))) { status = NT_STATUS_NO_MEMORY; goto error; diff --git a/source3/utils/net_rpc_rights.c b/source3/utils/net_rpc_rights.c index 1b99afa54e..737bfb0e86 100644 --- a/source3/utils/net_rpc_rights.c +++ b/source3/utils/net_rpc_rights.c @@ -506,7 +506,7 @@ static NTSTATUS rpc_rights_grant_internal(struct net_context *c, return status; rights.count = argc-1; - rights.names = TALLOC_ARRAY(mem_ctx, struct lsa_StringLarge, + rights.names = talloc_array(mem_ctx, struct lsa_StringLarge, rights.count); if (!rights.names) { return NT_STATUS_NO_MEMORY; @@ -579,7 +579,7 @@ static NTSTATUS rpc_rights_revoke_internal(struct net_context *c, return status; rights.count = argc-1; - rights.names = TALLOC_ARRAY(mem_ctx, struct lsa_StringLarge, + rights.names = talloc_array(mem_ctx, struct lsa_StringLarge, rights.count); if (!rights.names) { return NT_STATUS_NO_MEMORY; diff --git a/source3/web/swat.c b/source3/web/swat.c index 392b7131d8..277b25c426 100644 --- a/source3/web/swat.c +++ b/source3/web/swat.c @@ -101,7 +101,7 @@ static const char *fix_quotes(TALLOC_CTX *ctx, char *str) } ++p; } - newstring = TALLOC_ARRAY(ctx, char, newstring_len); + newstring = talloc_array(ctx, char, newstring_len); if (!newstring) { return ""; } diff --git a/source3/winbindd/idmap.c b/source3/winbindd/idmap.c index 2eb655f780..6ae10115b7 100644 --- a/source3/winbindd/idmap.c +++ b/source3/winbindd/idmap.c @@ -401,7 +401,7 @@ struct idmap_domain *idmap_find_domain(const char *domname) /* * talloc context for all idmap domains */ - idmap_domains = TALLOC_ARRAY(NULL, struct idmap_domain *, 1); + idmap_domains = talloc_array(NULL, struct idmap_domain *, 1); } if (idmap_domains == NULL) { diff --git a/source3/winbindd/idmap_adex/gc_util.c b/source3/winbindd/idmap_adex/gc_util.c index e4bf8d59d7..b16aa79997 100644 --- a/source3/winbindd/idmap_adex/gc_util.c +++ b/source3/winbindd/idmap_adex/gc_util.c @@ -781,10 +781,10 @@ done: #endif if (count == 0) { - ads_tmp = TALLOC_ARRAY(NULL, ADS_STRUCT*, 1); + ads_tmp = talloc_array(NULL, ADS_STRUCT*, 1); BAIL_ON_PTR_ERROR(ads_tmp, nt_status); - msg_tmp = TALLOC_ARRAY(NULL, LDAPMessage*, 1); + msg_tmp = talloc_array(NULL, LDAPMessage*, 1); BAIL_ON_PTR_ERROR(msg_tmp, nt_status); } else { ads_tmp = talloc_realloc(*ads_list, *ads_list, ADS_STRUCT*, diff --git a/source3/winbindd/wb_lookupsids.c b/source3/winbindd/wb_lookupsids.c index 46766dc7b1..4832a62f12 100644 --- a/source3/winbindd/wb_lookupsids.c +++ b/source3/winbindd/wb_lookupsids.c @@ -128,7 +128,7 @@ struct tevent_req *wb_lookupsids_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - state->single_sids = TALLOC_ARRAY(state, uint32_t, num_sids); + state->single_sids = talloc_array(state, uint32_t, num_sids); if (tevent_req_nomem(state->single_sids, req)) { return tevent_req_post(req, ev); } @@ -137,7 +137,7 @@ struct tevent_req *wb_lookupsids_send(TALLOC_CTX *mem_ctx, if (tevent_req_nomem(state->res_domains, req)) { return tevent_req_post(req, ev); } - state->res_domains->domains = TALLOC_ARRAY( + state->res_domains->domains = talloc_array( state->res_domains, struct lsa_DomainInfo, num_sids); if (tevent_req_nomem(state->res_domains->domains, req)) { return tevent_req_post(req, ev); @@ -147,7 +147,7 @@ struct tevent_req *wb_lookupsids_send(TALLOC_CTX *mem_ctx, if (tevent_req_nomem(state->res_names, req)) { return tevent_req_post(req, ev); } - state->res_names->names = TALLOC_ARRAY( + state->res_names->names = talloc_array( state->res_names, struct lsa_TranslatedName, num_sids); if (tevent_req_nomem(state->res_names->names, req)) { return tevent_req_post(req, ev); @@ -187,7 +187,7 @@ static bool wb_lookupsids_next(struct tevent_req *req, if (sid_check_is_domain(&d->sid)) { state->rids.num_rids = d->sids.num_sids; - state->rids.rids = TALLOC_ARRAY(state, uint32_t, + state->rids.rids = talloc_array(state, uint32_t, state->rids.num_rids); if (tevent_req_nomem(state->rids.rids, req)) { return false; @@ -337,13 +337,13 @@ static struct wb_lookupsids_domain *wb_lookupsids_get_domain( sid_split_rid(&domain->sid, NULL); domain->domain = wb_domain; - domain->sids.sids = TALLOC_ARRAY(domains, struct lsa_SidPtr, num_sids); + domain->sids.sids = talloc_array(domains, struct lsa_SidPtr, num_sids); if (domains->sids.sids == NULL) { goto fail; } domain->sids.num_sids = 0; - domain->sid_indexes = TALLOC_ARRAY(domains, uint32_t, num_sids); + domain->sid_indexes = talloc_array(domains, uint32_t, num_sids); if (domain->sid_indexes == NULL) { TALLOC_FREE(domain->sids.sids); goto fail; diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c index e1bacedaa4..a1f5ac69b5 100644 --- a/source3/winbindd/winbindd_cache.c +++ b/source3/winbindd/winbindd_cache.c @@ -309,7 +309,7 @@ static char *centry_string(struct cache_entry *centry, TALLOC_CTX *mem_ctx) smb_panic_fn("centry_string"); } - ret = TALLOC_ARRAY(mem_ctx, char, len+1); + ret = talloc_array(mem_ctx, char, len+1); if (!ret) { smb_panic_fn("centry_string out of memory\n"); } @@ -339,7 +339,7 @@ static char *centry_hash16(struct cache_entry *centry, TALLOC_CTX *mem_ctx) return NULL; } - ret = TALLOC_ARRAY(mem_ctx, char, 16); + ret = talloc_array(mem_ctx, char, 16); if (!ret) { smb_panic_fn("centry_hash out of memory\n"); } @@ -1436,7 +1436,7 @@ do_fetch_cache: if (*num_entries == 0) goto do_cached; - (*info) = TALLOC_ARRAY(mem_ctx, struct wbint_userinfo, *num_entries); + (*info) = talloc_array(mem_ctx, struct wbint_userinfo, *num_entries); if (! (*info)) { smb_panic_fn("query_user_list out of memory"); } @@ -1588,7 +1588,7 @@ do_fetch_cache: if (*num_entries == 0) goto do_cached; - (*info) = TALLOC_ARRAY(mem_ctx, struct wb_acct_info, *num_entries); + (*info) = talloc_array(mem_ctx, struct wb_acct_info, *num_entries); if (! (*info)) { smb_panic_fn("enum_dom_groups out of memory"); } @@ -1683,7 +1683,7 @@ do_fetch_cache: if (*num_entries == 0) goto do_cached; - (*info) = TALLOC_ARRAY(mem_ctx, struct wb_acct_info, *num_entries); + (*info) = talloc_array(mem_ctx, struct wb_acct_info, *num_entries); if (! (*info)) { smb_panic_fn("enum_dom_groups out of memory"); } @@ -2006,8 +2006,8 @@ static NTSTATUS rids_to_names(struct winbindd_domain *domain, return NT_STATUS_OK; } - *names = TALLOC_ARRAY(mem_ctx, char *, num_rids); - *types = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_rids); + *names = talloc_array(mem_ctx, char *, num_rids); + *types = talloc_array(mem_ctx, enum lsa_SidType, num_rids); if ((*names == NULL) || (*types == NULL)) { result = NT_STATUS_NO_MEMORY; @@ -4203,7 +4203,7 @@ static bool add_wbdomain_to_tdc_array( struct winbindd_domain *new_dom, if ( !set_only ) { if ( !*domains ) { - list = TALLOC_ARRAY( NULL, struct winbindd_tdc_domain, 1 ); + list = talloc_array( NULL, struct winbindd_tdc_domain, 1 ); idx = 0; } else { list = talloc_realloc( *domains, *domains, @@ -4346,7 +4346,7 @@ static size_t unpack_tdc_domains( unsigned char *buf, int buflen, return 0; } - list = TALLOC_ARRAY( NULL, struct winbindd_tdc_domain, num_domains ); + list = talloc_array( NULL, struct winbindd_tdc_domain, num_domains ); if ( !list ) { DEBUG(0,("unpack_tdc_domains: Failed to talloc() domain list!\n")); return 0; diff --git a/source3/winbindd/winbindd_msrpc.c b/source3/winbindd/winbindd_msrpc.c index b17cafe5d6..699320206a 100644 --- a/source3/winbindd/winbindd_msrpc.c +++ b/source3/winbindd/winbindd_msrpc.c @@ -342,7 +342,7 @@ static NTSTATUS msrpc_rids_to_names(struct winbindd_domain *domain, DEBUG(3, ("msrpc_rids_to_names: domain %s\n", domain->name )); if (num_rids) { - sids = TALLOC_ARRAY(mem_ctx, struct dom_sid, num_rids); + sids = talloc_array(mem_ctx, struct dom_sid, num_rids); if (sids == NULL) { return NT_STATUS_NO_MEMORY; } diff --git a/source3/winbindd/winbindd_rpc.c b/source3/winbindd/winbindd_rpc.c index a4e4887703..df8d7b52c2 100644 --- a/source3/winbindd/winbindd_rpc.c +++ b/source3/winbindd/winbindd_rpc.c @@ -404,7 +404,7 @@ NTSTATUS rpc_rids_to_names(TALLOC_CTX *mem_ctx, NTSTATUS status; if (num_rids > 0) { - sids = TALLOC_ARRAY(mem_ctx, struct dom_sid, num_rids); + sids = talloc_array(mem_ctx, struct dom_sid, num_rids); if (sids == NULL) { return NT_STATUS_NO_MEMORY; } @@ -594,7 +594,7 @@ NTSTATUS rpc_lookup_usergroups(TALLOC_CTX *mem_ctx, return result; } - user_grpsids = TALLOC_ARRAY(mem_ctx, struct dom_sid, num_groups); + user_grpsids = talloc_array(mem_ctx, struct dom_sid, num_groups); if (user_grpsids == NULL) { status = NT_STATUS_NO_MEMORY; return status; diff --git a/source3/winbindd/winbindd_sids_to_xids.c b/source3/winbindd/winbindd_sids_to_xids.c index 68616fa5b8..203ccfce09 100644 --- a/source3/winbindd/winbindd_sids_to_xids.c +++ b/source3/winbindd/winbindd_sids_to_xids.c @@ -85,7 +85,7 @@ struct tevent_req *winbindd_sids_to_xids_send(TALLOC_CTX *mem_ctx, if (tevent_req_nomem(state->cached, req)) { return tevent_req_post(req, ev); } - state->non_cached = TALLOC_ARRAY(state, struct dom_sid, + state->non_cached = talloc_array(state, struct dom_sid, state->num_sids); if (tevent_req_nomem(state->non_cached, req)) { return tevent_req_post(req, ev); @@ -176,7 +176,7 @@ static void winbindd_sids_to_xids_lookupsids_done(struct tevent_req *subreq) } state->ids.num_ids = state->num_non_cached; - state->ids.ids = TALLOC_ARRAY(state, struct wbint_TransID, + state->ids.ids = talloc_array(state, struct wbint_TransID, state->num_non_cached); if (tevent_req_nomem(state->ids.ids, req)) { return; diff --git a/source3/winbindd/winbindd_wins.c b/source3/winbindd/winbindd_wins.c index a468b0f8b3..7ed330f81b 100644 --- a/source3/winbindd/winbindd_wins.c +++ b/source3/winbindd/winbindd_wins.c @@ -42,7 +42,7 @@ static struct sockaddr_storage *lookup_byname_backend(TALLOC_CTX *mem_ctx, if (NT_STATUS_IS_OK(resolve_wins(name,0x20,&ret,count))) { if ( *count == 0 ) return NULL; - return_ss = TALLOC_ARRAY(mem_ctx, struct sockaddr_storage, + return_ss = talloc_array(mem_ctx, struct sockaddr_storage, *count); if (return_ss == NULL ) { free( ret ); |