diff --git a/lib/addns/dnsmarshall.c b/lib/addns/dnsmarshall.c index e5e8cf79621..3401b31469d 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 52391aef780..2d0dc9ec5be 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 42b4e2d40f0..da8a52100e3 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 37b862c7f07..526179bee3a 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 6abaf29cf0d..debae53da1f 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 70d11239c92..25d84e9d860 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 ff55a671f37..386e6678341 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 c252b253438..03f87afe140 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 04af27bcf3a..e37c951237d 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 1a6d4e152fc..cf8857cda54 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 cb364a9aa3a..e21977f748b 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 69ad8e4b20c..e195d6f6f3c 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 c3d863f9a44..f2452919af0 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 28619a0e44b..f1182100c70 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 c2494e2293a..ed971a97a6c 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 fe383663d76..1632cd2feb8 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 a6f7de0af50..342a5ffaed2 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 6fe8f67448f..a348b389e86 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 3fa1485d452..b458ebe8472 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; iattid == 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 8b76e8f5d8b..ad5685361bc 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 83cc81549a9..9eec97fbeb1 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 008db0b65a2..e5ff1abc18b 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 fc6c9ffc005..223309f7566 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 44dafa7e43f..99a358f81fc 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 64a956d9ee4..1dcf2dd5167 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 eec42ff6226..f5f4a7c1dcb 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 a4561f50d83..55412ec8b2a 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 3f1aa6da571..2e590413f86 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 4fdfdd997c0..658f3be1799 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 7aab6c3973b..15bebf6fea0 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 f1f82d243ee..eb7c6fed6b5 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 b29a4c4351d..3d7f6c1b038 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 549eb304bdd..a47d875b646 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 12e3ab17e32..6ec25c45c1c 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 5cf391f11c7..bb193f3cdde 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 36d5aaa01a7..d6f791053d4 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 5f89be7a29f..556283dc6b3 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 c21b54f74de..8167e3799ee 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 64529c78961..91adc8108b3 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 8d544f12402..a1337eac9d3 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 0c7236ef3b9..9fd73e87071 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 566ab0bc6b8..05f3a5a0ab7 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 8715ab56730..925ff8775a6 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 e5995711819..66192bdf54f 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 dcdf1f5a244..76d2cf164b0 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 6ca35a5dcc9..723760d601e 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 c7a9e1a97da..7c8ae19b82b 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 393dc314543..a120c6e7fe9 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 41e684d63d7..186526edfc2 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 6b037232a6c..f397333b4e4 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 c8e96e077dd..8505c8ffb5b 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 bf7ade8be6c..b2b8a1923d7 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 6f319e99054..6fee5b6acd9 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 cda25378ee8..3382eb1a5c7 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 f135b1e86c5..bcf4d5830d1 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 aee6f58fff3..b452000e139 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 085834b4ee9..1d296e342df 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 06de8ab4320..ee7b2ad6d23 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 02eb3361b87..8482a00f641 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 01200660fa7..2b8521d54aa 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 61e3a7e2d0e..1980f757fda 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 72907c5d3a1..b9a4d4624b8 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 c73bf6f36bb..9527a34af4d 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 6eca1da693e..9bb34dfe459 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 47f4efd5d80..0904f24356b 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 a157e91e5cc..d170604a1bf 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 20a6bdaa249..77b15a45c7b 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 1b99afa54e8..737bfb0e868 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 392b7131d82..277b25c4268 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 2eb655f7800..6ae10115b78 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 e4bf8d59d7a..b16aa799975 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 46766dc7b1b..4832a62f12c 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 e1bacedaa46..a1f5ac69b5c 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 b17cafe5d67..699320206a2 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 a4e48877031..df8d7b52c25 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 68616fa5b88..203ccfce091 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 a468b0f8b3d..7ed330f81bc 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 );