1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

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.
This commit is contained in:
Andrew Bartlett 2011-06-07 11:30:12 +10:00
parent 73b377432c
commit 3d15137653
84 changed files with 182 additions and 183 deletions

View File

@ -39,7 +39,7 @@ struct dns_buffer *dns_create_buffer(TALLOC_CTX *mem_ctx)
*/ */
result->size = 2; result->size = 2;
if (!(result->data = TALLOC_ARRAY(result, uint8, result->size))) { if (!(result->data = talloc_array(result, uint8, result->size))) {
TALLOC_FREE(result); TALLOC_FREE(result);
return NULL; return NULL;
} }
@ -223,7 +223,7 @@ static void dns_unmarshall_label(TALLOC_CTX *mem_ctx,
label->len = len; 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; buf->error = ERROR_DNS_NO_MEMORY;
goto error; goto error;
} }
@ -329,7 +329,7 @@ static void dns_unmarshall_rr(TALLOC_CTX *mem_ctx,
if (!(ERR_DNS_IS_OK(buf->error))) return; if (!(ERR_DNS_IS_OK(buf->error))) return;
if (r->data_length != 0) { 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; buf->error = ERROR_DNS_NO_MEMORY;
return; return;
} }
@ -406,22 +406,22 @@ DNS_ERROR dns_unmarshall_request(TALLOC_CTX *mem_ctx,
err = ERROR_DNS_NO_MEMORY; err = ERROR_DNS_NO_MEMORY;
if ((req->num_questions != 0) && if ((req->num_questions != 0) &&
!(req->questions = TALLOC_ARRAY(req, struct dns_question *, !(req->questions = talloc_array(req, struct dns_question *,
req->num_questions))) { req->num_questions))) {
goto error; goto error;
} }
if ((req->num_answers != 0) && if ((req->num_answers != 0) &&
!(req->answers = TALLOC_ARRAY(req, struct dns_rrec *, !(req->answers = talloc_array(req, struct dns_rrec *,
req->num_answers))) { req->num_answers))) {
goto error; goto error;
} }
if ((req->num_auths != 0) && if ((req->num_auths != 0) &&
!(req->auths = TALLOC_ARRAY(req, struct dns_rrec *, !(req->auths = talloc_array(req, struct dns_rrec *,
req->num_auths))) { req->num_auths))) {
goto error; goto error;
} }
if ((req->num_additionals != 0) && if ((req->num_additionals != 0) &&
!(req->additionals = TALLOC_ARRAY(req, struct dns_rrec *, !(req->additionals = talloc_array(req, struct dns_rrec *,
req->num_additionals))) { req->num_additionals))) {
goto error; goto error;
} }

View File

@ -32,7 +32,7 @@ DNS_ERROR dns_create_query( TALLOC_CTX *mem_ctx, const char *name,
DNS_ERROR err; DNS_ERROR err;
if (!(req = TALLOC_ZERO_P(mem_ctx, struct dns_request)) || 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, !(req->questions[0] = talloc(req->questions,
struct dns_question))) { struct dns_question))) {
TALLOC_FREE(req); TALLOC_FREE(req);
@ -65,7 +65,7 @@ DNS_ERROR dns_create_update( TALLOC_CTX *mem_ctx, const char *name,
DNS_ERROR err; DNS_ERROR err;
if (!(req = TALLOC_ZERO_P(mem_ctx, struct dns_update_request)) || 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))) { !(req->zones[0] = talloc(req->zones, struct dns_zone))) {
TALLOC_FREE(req); TALLOC_FREE(req);
return ERROR_DNS_NO_MEMORY; 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 (!ERR_DNS_IS_OK(buf.error)) goto error;
if (tkey->key_length) { 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; buf.error = ERROR_DNS_NO_MEMORY;
goto error; goto error;
} }

View File

@ -262,7 +262,7 @@ static DNS_ERROR dns_receive_tcp(TALLOC_CTX *mem_ctx,
buf->size = ntohs(len); buf->size = ntohs(len);
if (buf->size) { if (buf->size) {
if (!(buf->data = TALLOC_ARRAY(buf, uint8, buf->size))) { if (!(buf->data = talloc_array(buf, uint8, buf->size))) {
TALLOC_FREE(buf); TALLOC_FREE(buf);
return ERROR_DNS_NO_MEMORY; 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 * 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); TALLOC_FREE(buf);
return ERROR_DNS_NO_MEMORY; return ERROR_DNS_NO_MEMORY;
} }

View File

@ -138,7 +138,7 @@ char *dns_generate_keyname( TALLOC_CTX *mem_ctx )
/* /*
* uuid_unparse gives 36 bytes plus '\0' * 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; return NULL;
} }

View File

@ -640,7 +640,7 @@ ADS_STATUS ads_get_sid_token(ADS_STRUCT *ads,
return status; 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); ADS_ERROR_HAVE_NO_MEMORY(token_sids);
status = ADS_ERROR_NT(add_sid_to_array_unique(mem_ctx, status = ADS_ERROR_NT(add_sid_to_array_unique(mem_ctx,

View File

@ -519,7 +519,7 @@ NTSTATUS create_local_token(TALLOC_CTX *mem_ctx,
t = session_info->security_token; t = session_info->security_token;
ids = TALLOC_ARRAY(talloc_tos(), struct wbcUnixId, ids = talloc_array(talloc_tos(), struct wbcUnixId,
t->num_sids); t->num_sids);
if (ids == NULL) { if (ids == NULL) {
return NT_STATUS_NO_MEMORY; return NT_STATUS_NO_MEMORY;

View File

@ -693,9 +693,9 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
num_group_sids = getgroups_num_group_sids; num_group_sids = getgroups_num_group_sids;
if (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) { if (group_sids == NULL) {
DEBUG(1, ("TALLOC_ARRAY failed\n")); DEBUG(1, ("talloc_array failed\n"));
result = NT_STATUS_NO_MEMORY; result = NT_STATUS_NO_MEMORY;
goto done; goto done;
} }
@ -732,9 +732,9 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username,
} }
num_group_sids = 1; 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) { if (group_sids == NULL) {
DEBUG(1, ("TALLOC_ARRAY failed\n")); DEBUG(1, ("talloc_array failed\n"));
result = NT_STATUS_NO_MEMORY; result = NT_STATUS_NO_MEMORY;
goto done; goto done;
} }

View File

@ -124,7 +124,7 @@ do_smb_browse_reply(DNSServiceRef sdRef, DNSServiceFlags flags,
return; return;
} }
bresult = TALLOC_ARRAY(talloc_tos(), struct mdns_smbsrv_result, 1); bresult = talloc_array(talloc_tos(), struct mdns_smbsrv_result, 1);
if (bresult == NULL) { if (bresult == NULL) {
return; return;
} }

View File

@ -635,7 +635,7 @@ NTSTATUS pdb_default_alias_memberships(struct pdb_methods *methods,
return NT_STATUS_OK; 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) if (*pp_alias_rids == NULL)
return NT_STATUS_NO_MEMORY; return NT_STATUS_NO_MEMORY;

View File

@ -145,7 +145,7 @@ static bool add_mapping_entry(GROUP_MAP *map, int flag)
len = tdb_pack(NULL, 0, "ddff", len = tdb_pack(NULL, 0, "ddff",
map->gid, map->sid_name_use, map->nt_name, map->comment); 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) { if (!buf) {
TALLOC_FREE(key); TALLOC_FREE(key);
return false; return false;

View File

@ -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(ctx, size) talloc_named_const(ctx, size, __location__)
#define TALLOC_P(ctx, type) (type *)talloc_named_const(ctx, sizeof(type), #type) #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_MEMDUP(ctx, ptr, size) _talloc_memdup(ctx, ptr, size, __location__)
#define TALLOC_ZERO(ctx, size) _talloc_zero(ctx, 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) #define TALLOC_ZERO_P(ctx, type) (type *)_talloc_zero(ctx, sizeof(type), #type)

View File

@ -168,7 +168,7 @@ static struct db_record *db_file_fetch_locked(struct db_context *db,
if (statbuf.st_size != 0) { if (statbuf.st_size != 0) {
result->value.dsize = statbuf.st_size; result->value.dsize = statbuf.st_size;
result->value.dptr = TALLOC_ARRAY(result, uint8, result->value.dptr = talloc_array(result, uint8,
statbuf.st_size); statbuf.st_size);
if (result->value.dptr == NULL) { if (result->value.dptr == NULL) {
DEBUG(1, ("talloc failed\n")); DEBUG(1, ("talloc failed\n"));

View File

@ -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 * sys_poll and in the clustering case we might have to add
* the ctdb fd. This avoids the realloc then. * 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) { if (pollfds == NULL) {
status = NT_STATUS_NO_MEMORY; status = NT_STATUS_NO_MEMORY;
break; break;

View File

@ -3572,7 +3572,7 @@ WERROR NetUserGetLocalGroups_r(struct libnetapi_ctx *ctx,
} }
sid_array.num_sids = rid_array->count + 1; 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) { if (!sid_array.sids) {
werr = WERR_NOMEM; werr = WERR_NOMEM;
goto done; goto done;

View File

@ -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. */ /* Add the number of ',' characters to get the number of aces. */
num_aces += count_chars(pacl,','); 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) { if (!ace_list) {
return False; return False;
} }

View File

@ -239,7 +239,7 @@ ATTRIB_MAP_ENTRY sidmap_attr_list[] = {
i++; i++;
i++; i++;
names = TALLOC_ARRAY( mem_ctx, const char*, i ); names = talloc_array( mem_ctx, const char*, i );
if ( !names ) { if ( !names ) {
DEBUG(0,("get_attr_list: out of memory\n")); DEBUG(0,("get_attr_list: out of memory\n"));
return NULL; return NULL;

View File

@ -1382,7 +1382,7 @@ static char **extract_args(TALLOC_CTX *mem_ctx, const char *command)
TALLOC_FREE(trunc_cmd); TALLOC_FREE(trunc_cmd);
if (!(argl = TALLOC_ARRAY(mem_ctx, char *, argcl + 1))) { if (!(argl = talloc_array(mem_ctx, char *, argcl + 1))) {
goto nomem; goto nomem;
} }

View File

@ -624,7 +624,7 @@ bool str_list_substitute(char **list, const char *pattern, const char *insert)
t = *list; t = *list;
d = p -t; d = p -t;
if (ld) { if (ld) {
t = TALLOC_ARRAY(ctx, char, ls +ld +1); t = talloc_array(ctx, char, ls +ld +1);
if (!t) { if (!t) {
DEBUG(0,("str_list_substitute: " DEBUG(0,("str_list_substitute: "
"Unable to allocate memory")); "Unable to allocate memory"));
@ -926,7 +926,7 @@ void sprintf_append(TALLOC_CTX *mem_ctx, char **string, ssize_t *len,
if (*bufsize == 0) if (*bufsize == 0)
*bufsize = 128; *bufsize = 128;
*string = TALLOC_ARRAY(mem_ctx, char, *bufsize); *string = talloc_array(mem_ctx, char, *bufsize);
if (*string == NULL) if (*string == NULL)
goto error; goto error;
} }
@ -1229,7 +1229,7 @@ char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string,
if (!string || !*string) if (!string || !*string)
return NULL; 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) { if (list == NULL) {
return NULL; return NULL;
} }

View File

@ -237,8 +237,8 @@ bool winbind_lookup_rids(TALLOC_CTX *mem_ctx,
} }
*domain_name = talloc_strdup(mem_ctx, dom_name); *domain_name = talloc_strdup(mem_ctx, dom_name);
*names = TALLOC_ARRAY(mem_ctx, const char*, num_rids); *names = talloc_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);
for(i=0; i<num_rids; i++) { for(i=0; i<num_rids; i++) {
(*names)[i] = talloc_strdup(*names, namelist[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) if (ret != WBC_ERR_SUCCESS)
return false; return false;
*_groups = TALLOC_ARRAY(mem_ctx, gid_t, ngroups); *_groups = talloc_array(mem_ctx, gid_t, ngroups);
if (*_groups == NULL) { if (*_groups == NULL) {
wbcFreeMemory(group_list); wbcFreeMemory(group_list);
return false; return false;
@ -313,7 +313,7 @@ bool winbind_get_sid_aliases(TALLOC_CTX *mem_ctx,
memcpy(&domain_sid, dom_sid, sizeof(*dom_sid)); 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++) { for (i=0; i < num_members; i++) {
memcpy(&sid_list[i], &members[i], sizeof(sid_list[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; 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) { if (*pp_alias_rids == NULL) {
wbcFreeMemory(rids); wbcFreeMemory(rids);
return false; return false;

View File

@ -328,7 +328,7 @@ static NTSTATUS dns_send_req( TALLOC_CTX *ctx, const char *name, int q_type,
buf_len = resp_len * sizeof(uint8); buf_len = resp_len * sizeof(uint8);
if (buf_len) { if (buf_len) {
if ((buffer = TALLOC_ARRAY(ctx, uint8, buf_len)) if ((buffer = talloc_array(ctx, uint8, buf_len))
== NULL ) { == NULL ) {
DEBUG(0,("ads_dns_lookup_srv: " DEBUG(0,("ads_dns_lookup_srv: "
"talloc() failed!\n")); "talloc() failed!\n"));
@ -534,7 +534,7 @@ static NTSTATUS ads_dns_lookup_srv( TALLOC_CTX *ctx,
/* allocate new memory */ /* allocate new memory */
if (dcs[i].num_ips == 0) { 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 )) struct sockaddr_storage, 1 ))
== NULL ) { == NULL ) {
return NT_STATUS_NO_MEMORY; return NT_STATUS_NO_MEMORY;
@ -638,7 +638,7 @@ NTSTATUS ads_dns_lookup_ns(TALLOC_CTX *ctx,
answer_count)); answer_count));
if (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 ) { answer_count)) == NULL ) {
DEBUG(0,("ads_dns_lookup_ns: " DEBUG(0,("ads_dns_lookup_ns: "
"talloc() failure for %d char*'s\n", "talloc() failure for %d char*'s\n",

View File

@ -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) { if (S_ISLNK(sbuf.st_ex_mode) && sbuf.st_ex_size) {
int lret; int lret;
size_t alloc_size = sbuf.st_ex_size + 1; 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); alloc_size);
if (!linkpath) { if (!linkpath) {
goto done; goto done;

View File

@ -2433,7 +2433,7 @@ int ads_count_replies(ADS_STRUCT *ads, void *res)
*num_values = ldap_count_values(values); *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) { if (!ret) {
ldap_value_free(values); ldap_value_free(values);
return NULL; return NULL;
@ -2669,7 +2669,7 @@ int ads_count_replies(ADS_STRUCT *ads, void *res)
/* nop */ ; /* nop */ ;
if (i) { if (i) {
(*sids) = TALLOC_ARRAY(mem_ctx, struct dom_sid, i); (*sids) = talloc_array(mem_ctx, struct dom_sid, i);
if (!(*sids)) { if (!(*sids)) {
ldap_value_free_len(values); ldap_value_free_len(values);
return 0; return 0;

View File

@ -199,7 +199,7 @@ static bool map_multi_sz(TALLOC_CTX *ctx, ADS_MODLIST *mods,
}; };
if (num_vals) { if (num_vals) {
str_values = TALLOC_ARRAY(ctx, char *, num_vals + 1); str_values = talloc_array(ctx, char *, num_vals + 1);
if (!str_values) { if (!str_values) {
return False; return False;
} }

View File

@ -76,11 +76,11 @@ static ADS_STATUS ads_get_attrnames_by_oids(ADS_STRUCT *ads,
goto out; 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); status = ADS_ERROR(LDAP_NO_MEMORY);
goto out; 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); status = ADS_ERROR(LDAP_NO_MEMORY);
goto out; goto out;
} }

View File

@ -242,7 +242,7 @@ ADS_STATUS ads_ranged_search(ADS_STRUCT *ads,
*num_strings = 0; *num_strings = 0;
*strings = NULL; *strings = NULL;
attrs = TALLOC_ARRAY(mem_ctx, const char *, 3); attrs = talloc_array(mem_ctx, const char *, 3);
ADS_ERROR_HAVE_NO_MEMORY(attrs); ADS_ERROR_HAVE_NO_MEMORY(attrs);
attrs[0] = talloc_strdup(mem_ctx, range_attr); attrs[0] = talloc_strdup(mem_ctx, range_attr);

View File

@ -276,7 +276,7 @@ static NTSTATUS parse_object(TALLOC_CTX *mem_ctx,
if (attr->attid == DRSUAPI_ATTID_servicePrincipalName) { if (attr->attid == DRSUAPI_ATTID_servicePrincipalName) {
uint32_t count; uint32_t count;
num_spns = attr->value_ctr.num_values; 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++) { for (count = 0; count < num_spns; count++) {
blob = attr->value_ctr.values[count].blob; blob = attr->value_ctr.values[count].blob;
pull_string_talloc(spn, NULL, 0, pull_string_talloc(spn, NULL, 0,

View File

@ -3998,7 +3998,7 @@ static bool parse_ea_blob(TALLOC_CTX *ctx, const uint8_t *rdata,
return true; 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) { if (!ea_list) {
return false; return false;
} }

View File

@ -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; 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) { if (finfo == NULL) {
return NT_STATUS_NO_MEMORY; 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; state->setup[0] = TRANSACT2_FINDFIRST;
nlen = 2*(strlen(mask)+1); 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)) { if (tevent_req_nomem(state->param, req)) {
return tevent_req_post(req, ev); return tevent_req_post(req, ev);
} }

View File

@ -1023,7 +1023,7 @@ static bool parse_streams_blob(TALLOC_CTX *mem_ctx, const uint8_t *rdata,
* convert_string_talloc?? * 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) { if (tmp_buf == NULL) {
goto fail; goto fail;
} }

View File

@ -704,7 +704,7 @@ NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
* 3 bytes prefix * 3 bytes prefix
*/ */
bytes = TALLOC_ARRAY(talloc_tos(), uint8_t, 3); bytes = talloc_array(talloc_tos(), uint8_t, 3);
if (bytes == NULL) { if (bytes == NULL) {
return NT_STATUS_NO_MEMORY; return NT_STATUS_NO_MEMORY;
} }

View File

@ -148,7 +148,7 @@ static NTSTATUS cli_trans_pull_blob(TALLOC_CTX *mem_ctx,
return NT_STATUS_INVALID_NETWORK_RESPONSE; return NT_STATUS_INVALID_NETWORK_RESPONSE;
} }
blob->total = total; 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) { if (blob->data == NULL) {
return NT_STATUS_NO_MEMORY; return NT_STATUS_NO_MEMORY;
} }

View File

@ -88,7 +88,7 @@ urldecode_talloc(TALLOC_CTX *ctx, char **pp_dest, const char *src)
newlen++; newlen++;
} }
dest = TALLOC_ARRAY(ctx, char, newlen); dest = talloc_array(ctx, char, newlen);
if (!dest) { if (!dest) {
return err_count; return err_count;
} }

View File

@ -237,7 +237,7 @@ static struct node_status *parse_node_status(TALLOC_CTX *mem_ctx, char *p,
if (*num_names == 0) if (*num_names == 0)
return NULL; return NULL;
ret = TALLOC_ARRAY(mem_ctx, struct node_status,*num_names); ret = talloc_array(mem_ctx, struct node_status,*num_names);
if (!ret) if (!ret)
return NULL; 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) static bool prioritize_ipv4_list(struct ip_service *iplist, int count)
{ {
TALLOC_CTX *frame = talloc_stackframe(); 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; int i, j;
if (iplist_new == NULL) { if (iplist_new == NULL) {
@ -2514,7 +2514,7 @@ NTSTATUS resolve_name_list(TALLOC_CTX *ctx,
return NT_STATUS_BAD_NETWORK_NAME; return NT_STATUS_BAD_NETWORK_NAME;
} }
*return_ss_arr = TALLOC_ARRAY(ctx, *return_ss_arr = talloc_array(ctx,
struct sockaddr_storage, struct sockaddr_storage,
num_entries); num_entries);
if (!(*return_ss_arr)) { if (!(*return_ss_arr)) {

View File

@ -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->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); pdtl->delete_token->ngroups);
if (pdtl->delete_token->groups == NULL) { if (pdtl->delete_token->groups == NULL) {
DEBUG(0,("parse_delete_tokens_list: talloc failed")); 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 + sp_len + 1 +
bn_len + 1 + bn_len + 1 +
sn_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) { if (result.dptr == NULL) {
smb_panic("talloc failed"); smb_panic("talloc failed");
@ -1082,7 +1082,7 @@ bool rename_share_filename(struct messaging_context *msg_ctx,
sn_len + 1; sn_len + 1;
/* Set up the name changed message. */ /* Set up the name changed message. */
frm = TALLOC_ARRAY(lck, char, msg_len); frm = talloc_array(lck, char, msg_len);
if (!frm) { if (!frm) {
return False; return False;
} }

View File

@ -558,7 +558,7 @@ static void add_fd_to_close_entry(files_struct *fsp)
SMB_ASSERT(rec != NULL); SMB_ASSERT(rec != NULL);
new_data = TALLOC_ARRAY( new_data = talloc_array(
rec, uint8_t, rec->value.dsize + sizeof(fsp->fh->fd)); rec, uint8_t, rec->value.dsize + sizeof(fsp->fh->fd));
SMB_ASSERT(new_data != NULL); SMB_ASSERT(new_data != NULL);

View File

@ -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); gid_to_sid(&group_sid, psbuf->st_ex_gid);
if (afs_acl->num_aces) { 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) if (nt_ace_list == NULL)
return 0; return 0;

View File

@ -75,7 +75,7 @@ static SMB_STRUCT_DIRENT *cap_readdir(vfs_handle_struct *handle,
} }
DEBUG(3,("cap: cap_readdir: %s\n", newname)); DEBUG(3,("cap: cap_readdir: %s\n", newname));
newnamelen = strlen(newname)+1; newnamelen = strlen(newname)+1;
newdirent = (SMB_STRUCT_DIRENT *)TALLOC_ARRAY(talloc_tos(), newdirent = (SMB_STRUCT_DIRENT *)talloc_array(talloc_tos(),
char, char,
sizeof(SMB_STRUCT_DIRENT)+ sizeof(SMB_STRUCT_DIRENT)+
newnamelen); newnamelen);
@ -663,7 +663,7 @@ static char *capencode(TALLOC_CTX *ctx, const char *from)
} }
len++; len++;
to = TALLOC_ARRAY(ctx, char, len); to = talloc_array(ctx, char, len);
if (!to) { if (!to) {
return NULL; return NULL;
} }
@ -704,7 +704,7 @@ static char *capdecode(TALLOC_CTX *ctx, const char *from)
} }
len++; len++;
to = TALLOC_ARRAY(ctx, char, len); to = talloc_array(ctx, char, len);
if (!to) { if (!to) {
return NULL; return NULL;
} }

View File

@ -178,7 +178,7 @@ static int expand_msdfs_readlink(struct vfs_handle_struct *handle,
{ {
TALLOC_CTX *ctx = talloc_tos(); TALLOC_CTX *ctx = talloc_tos();
int result; int result;
char *target = TALLOC_ARRAY(ctx, char, PATH_MAX+1); char *target = talloc_array(ctx, char, PATH_MAX+1);
size_t len; size_t len;
if (!target) { if (!target) {

View File

@ -193,7 +193,7 @@ static bool preopen_helper(int fd, size_t to_read)
char *namebuf; char *namebuf;
void *readbuf; void *readbuf;
namebuf = TALLOC_ARRAY(NULL, char, 1024); namebuf = talloc_array(NULL, char, 1024);
if (namebuf == NULL) { if (namebuf == NULL) {
return false; 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->num_helpers = num_helpers;
result->helpers = TALLOC_ARRAY(result, struct preopen_helper, result->helpers = talloc_array(result, struct preopen_helper,
num_helpers); num_helpers);
if (result->helpers == NULL) { if (result->helpers == NULL) {
TALLOC_FREE(result); TALLOC_FREE(result);

View File

@ -632,7 +632,7 @@ static SMB_STRUCT_DIRENT *scannedonly_readdir(vfs_handle_struct *handle,
ctx,"%s %s",result->d_name, ctx,"%s %s",result->d_name,
STRUCTSCANO(handle->data)->scanning_message); STRUCTSCANO(handle->data)->scanning_message);
namelen = strlen(notify_name); namelen = strlen(notify_name);
newdirent = (SMB_STRUCT_DIRENT *)TALLOC_ARRAY( newdirent = (SMB_STRUCT_DIRENT *)talloc_array(
ctx, char, sizeof(SMB_STRUCT_DIRENT) + namelen + 1); ctx, char, sizeof(SMB_STRUCT_DIRENT) + namelen + 1);
if (!newdirent) { if (!newdirent) {
return NULL; return NULL;

View File

@ -1714,7 +1714,7 @@ static bool create_listen_pollfds(struct pollfd **pfds,
return true; return true;
} }
attrs = TALLOC_ARRAY(NULL, struct socket_attributes, count); attrs = talloc_array(NULL, struct socket_attributes, count);
if (fds == NULL) { if (fds == NULL) {
DEBUG(1, ("create_listen_pollfds: malloc fail for attrs. " DEBUG(1, ("create_listen_pollfds: malloc fail for attrs. "
"size %d\n", count)); "size %d\n", count));

View File

@ -483,7 +483,7 @@ static bool lookup_rids(TALLOC_CTX *mem_ctx, const struct dom_sid *domain_sid,
if (num_rids) { if (num_rids) {
*names = TALLOC_ZERO_ARRAY(mem_ctx, const char *, 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)) { if ((*names == NULL) || (*types == NULL)) {
return false; return false;
@ -750,7 +750,7 @@ NTSTATUS lookup_sids(TALLOC_CTX *mem_ctx, int num_sids,
} }
if (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) { if (name_infos == NULL) {
result = NT_STATUS_NO_MEMORY; result = NT_STATUS_NO_MEMORY;
goto fail; goto fail;
@ -896,7 +896,7 @@ NTSTATUS lookup_sids(TALLOC_CTX *mem_ctx, int num_sids,
} }
if (dom->num_idxs) { 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; result = NT_STATUS_NO_MEMORY;
goto fail; goto fail;
} }
@ -1404,7 +1404,7 @@ bool sids_to_unix_ids(const struct dom_sid *sids, uint32_t num_sids,
wbcErr err; wbcErr err;
bool ret = false; 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) { if (wbc_sids == NULL) {
return false; 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) { if (num_not_cached == 0) {
goto done; 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) { if (wbc_ids == NULL) {
goto fail; goto fail;
} }

View File

@ -1570,7 +1570,7 @@ static NTSTATUS pdb_default_enum_group_memberships(struct pdb_methods *methods,
smb_panic("primary group missing"); 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) { if (*pp_sids == NULL) {
TALLOC_FREE(*pp_gids); TALLOC_FREE(*pp_gids);

View File

@ -636,7 +636,7 @@ static NTSTATUS ipasam_enum_trusted_domains(struct pdb_methods *methods,
} }
*num_domains = 0; *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")); DEBUG(1, ("talloc failed\n"));
return NT_STATUS_NO_MEMORY; return NT_STATUS_NO_MEMORY;
} }
@ -684,7 +684,7 @@ static NTSTATUS ipasam_enum_trusteddoms(struct pdb_methods *methods,
return NT_STATUS_OK; return NT_STATUS_OK;
} }
if (!(*domains = TALLOC_ARRAY(mem_ctx, struct trustdom_info *, if (!(*domains = talloc_array(mem_ctx, struct trustdom_info *,
*num_domains))) { *num_domains))) {
DEBUG(1, ("talloc failed\n")); DEBUG(1, ("talloc failed\n"));
return NT_STATUS_NO_MEMORY; return NT_STATUS_NO_MEMORY;

View File

@ -208,7 +208,7 @@ static NTSTATUS ldapsam_get_seq_num(struct pdb_methods *my_methods, time_t *seq_
if (mem_ctx == NULL) if (mem_ctx == NULL)
return NT_STATUS_NO_MEMORY; 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; ntstatus = NT_STATUS_NO_MEMORY;
goto done; goto done;
} }
@ -887,7 +887,7 @@ static bool init_sam_from_ldap(struct ldapsam_privates *ldap_state,
if (pwHistLen > 0){ if (pwHistLen > 0){
uint8 *pwhist = NULL; uint8 *pwhist = NULL;
int i; int i;
char *history_string = TALLOC_ARRAY(ctx, char, char *history_string = talloc_array(ctx, char,
MAX_PW_HISTORY_LEN*64); MAX_PW_HISTORY_LEN*64);
if (!history_string) { 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); pwHistLen = MIN(pwHistLen, MAX_PW_HISTORY_LEN);
pwhist = TALLOC_ARRAY(ctx, uint8, pwhist = talloc_array(ctx, uint8,
pwHistLen * PW_HISTORY_ENTRY_LEN); pwHistLen * PW_HISTORY_ENTRY_LEN);
if (pwhist == NULL) { if (pwhist == NULL) {
DEBUG(0, ("init_sam_from_ldap: talloc failed!\n")); DEBUG(0, ("init_sam_from_ldap: talloc failed!\n"));
@ -4340,7 +4340,7 @@ static const char **talloc_attrs(TALLOC_CTX *mem_ctx, ...)
num += 1; num += 1;
va_end(ap); 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; return NULL;
} }
@ -6356,7 +6356,7 @@ static NTSTATUS ldapsam_enum_trusteddoms(struct pdb_methods *methods,
} }
*num_domains = 0; *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")); DEBUG(1, ("talloc failed\n"));
return NT_STATUS_NO_MEMORY; return NT_STATUS_NO_MEMORY;
} }

View File

@ -112,7 +112,7 @@ static NTSTATUS pdb_wbc_sam_enum_group_memberships(struct pdb_methods *methods,
smb_panic("primary group missing"); 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) { if (*pp_sids == NULL) {
TALLOC_FREE(*pp_gids); TALLOC_FREE(*pp_gids);

View File

@ -459,7 +459,7 @@ NTSTATUS secrets_trusted_domains(TALLOC_CTX *mem_ctx, uint32 *num_domains,
* exists * exists
*/ */
if (!(state.domains = TALLOC_ARRAY( if (!(state.domains = talloc_array(
mem_ctx, struct trustdom_info *, 1))) { mem_ctx, struct trustdom_info *, 1))) {
return NT_STATUS_NO_MEMORY; return NT_STATUS_NO_MEMORY;
} }

View File

@ -650,7 +650,7 @@ static bool print_notify_pid_list(const char *printername, TALLOC_CTX *mem_ctx,
num_pids = data.dsize / 8; num_pids = data.dsize / 8;
if (num_pids) { 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; ret = False;
goto done; goto done;
} }

View File

@ -1820,7 +1820,7 @@ static bool regdb_store_values_internal(struct db_context *db, const char *key,
goto done; goto done;
} }
data.dptr = TALLOC_ARRAY(ctx, uint8, len); data.dptr = talloc_array(ctx, uint8, len);
data.dsize = len; data.dsize = len;
len = regdb_pack_values(values, data.dptr, data.dsize); len = regdb_pack_values(values, data.dptr, data.dsize);

View File

@ -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; nk->values_off = prs_offset( &vlist_hbin->ps ) + vlist_hbin->first_hbin_off - HBIN_HDR_SIZE;
if (nk->num_values) { 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; return NULL;
} else { } else {
nk->values = NULL; nk->values = NULL;

View File

@ -187,7 +187,7 @@ static NTSTATUS dcerpc_lsa_lookup_sids_noalloc(struct dcerpc_binding_handle *h,
ZERO_STRUCT(lsa_names); ZERO_STRUCT(lsa_names);
sid_array.num_sids = num_sids; 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) { if (sid_array.sids == NULL) {
return NT_STATUS_NO_MEMORY; 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; bool have_unmapped = false;
if (num_sids) { 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")); DEBUG(0, ("rpccli_lsa_lookup_sids(): out of memory\n"));
status = NT_STATUS_NO_MEMORY; status = NT_STATUS_NO_MEMORY;
goto fail; 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")); DEBUG(0, ("rpccli_lsa_lookup_sids(): out of memory\n"));
status = NT_STATUS_NO_MEMORY; status = NT_STATUS_NO_MEMORY;
goto fail; 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")); DEBUG(0, ("rpccli_lsa_lookup_sids(): out of memory\n"));
status = NT_STATUS_NO_MEMORY; status = NT_STATUS_NO_MEMORY;
goto fail; 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_array);
ZERO_STRUCT(sid_array3); 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) { if (lsa_names == NULL) {
return NT_STATUS_NO_MEMORY; 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 (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")); DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n"));
*presult = NT_STATUS_NO_MEMORY; *presult = NT_STATUS_NO_MEMORY;
goto done; 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")); DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n"));
*presult = NT_STATUS_NO_MEMORY; *presult = NT_STATUS_NO_MEMORY;
goto done; goto done;
} }
if (dom_names != NULL) { 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) { if (*dom_names == NULL) {
DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n")); DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n"));
*presult = NT_STATUS_NO_MEMORY; *presult = NT_STATUS_NO_MEMORY;

View File

@ -606,7 +606,7 @@ static void cli_api_pipe_write_done(struct tevent_req *subreq)
return; 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)) { if (tevent_req_nomem(state->rdata, req)) {
return; return;
} }
@ -2565,7 +2565,7 @@ static NTSTATUS rpc_pipe_get_tcp_port(const char *host,
/* allocate further parameters for the epm_Map call */ /* 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) { if (res_towers == NULL) {
status = NT_STATUS_NO_MEMORY; status = NT_STATUS_NO_MEMORY;
goto done; goto done;

View File

@ -88,7 +88,7 @@ WERROR _dfs_Add(struct pipes_struct *p, struct dfs_Add *r)
return WERR_NOMEM; 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) { if(jn->referral_list == NULL) {
DEBUG(0,("init_reply_dfs_add: talloc failed for referral list!\n")); DEBUG(0,("init_reply_dfs_add: talloc failed for referral list!\n"));
return WERR_DFS_INTERNAL_ERROR; 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 */ /* also enumerate the stores */
if (j->referral_count) { 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) if (!dfs3->stores)
return False; return False;
memset(dfs3->stores, '\0', j->referral_count * sizeof(struct dfs_StorageInfo)); 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) { switch (r->in.level) {
case 1: case 1:
if (num_jn) { 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; return WERR_NOMEM;
} }
} else { } else {
@ -305,7 +305,7 @@ WERROR _dfs_Enum(struct pipes_struct *p, struct dfs_Enum *r)
break; break;
case 2: case 2:
if (num_jn) { 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; return WERR_NOMEM;
} }
} else { } else {
@ -315,7 +315,7 @@ WERROR _dfs_Enum(struct pipes_struct *p, struct dfs_Enum *r)
break; break;
case 3: case 3:
if (num_jn) { 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; return WERR_NOMEM;
} }
} else { } else {

View File

@ -48,7 +48,7 @@ void _echo_EchoData(struct pipes_struct *p, struct echo_EchoData *r)
return; 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 ); memcpy( r->out.out_data, r->in.in_data, r->in.len );
return; return;
} }
@ -76,7 +76,7 @@ void _echo_SourceData(struct pipes_struct *p, struct echo_SourceData *r)
return; 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++ ) { for (i = 0; i < r->in.len; i++ ) {
r->out.data[i] = i & 0xff; r->out.data[i] = i & 0xff;

View File

@ -858,7 +858,7 @@ static NTSTATUS _lsa_lookup_sids_internal(struct pipes_struct *p,
return NT_STATUS_OK; 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); ref = TALLOC_ZERO_P(p->mem_ctx, struct lsa_RefDomainList);
if (sids == NULL || ref == NULL) { if (sids == NULL || ref == NULL) {
@ -876,7 +876,7 @@ static NTSTATUS _lsa_lookup_sids_internal(struct pipes_struct *p,
return status; 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) { if (names == NULL) {
return NT_STATUS_NO_MEMORY; return NT_STATUS_NO_MEMORY;
} }
@ -998,7 +998,7 @@ NTSTATUS _lsa_LookupSids(struct pipes_struct *p,
} }
/* Convert from lsa_TranslatedName2 to lsa_TranslatedName */ /* 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); num_sids);
if (!names_out) { if (!names_out) {
return NT_STATUS_NO_MEMORY; return NT_STATUS_NO_MEMORY;
@ -1257,7 +1257,7 @@ NTSTATUS _lsa_LookupNames2(struct pipes_struct *p,
status = _lsa_LookupNames(p, &q); status = _lsa_LookupNames(p, &q);
sid_array2->count = sid_array->count; 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) { if (!sid_array2->sids) {
return NT_STATUS_NO_MEMORY; return NT_STATUS_NO_MEMORY;
} }

View File

@ -5298,7 +5298,7 @@ NTSTATUS _samr_GetAliasMembership(struct pipes_struct *p,
return NT_STATUS_OBJECT_TYPE_MISMATCH; return NT_STATUS_OBJECT_TYPE_MISMATCH;
if (r->in.sids->num_sids) { 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) if (members == NULL)
return NT_STATUS_NO_MEMORY; return NT_STATUS_NO_MEMORY;

View File

@ -6924,7 +6924,7 @@ static WERROR enumjobs_level1(TALLOC_CTX *mem_ctx,
int i; int i;
WERROR result = WERR_OK; 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); W_ERROR_HAVE_NO_MEMORY(info);
*count = num_queues; *count = num_queues;
@ -6968,7 +6968,7 @@ static WERROR enumjobs_level2(TALLOC_CTX *mem_ctx,
int i; int i;
WERROR result = WERR_OK; 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); W_ERROR_HAVE_NO_MEMORY(info);
*count = num_queues; *count = num_queues;
@ -7023,7 +7023,7 @@ static WERROR enumjobs_level3(TALLOC_CTX *mem_ctx,
int i; int i;
WERROR result = WERR_OK; 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); W_ERROR_HAVE_NO_MEMORY(info);
*count = num_queues; *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 no hook then just fill in the default port */
if ( !*cmd ) { if ( !*cmd ) {
if (!(qlines = TALLOC_ARRAY( NULL, char*, 2 ))) { if (!(qlines = talloc_array( NULL, char*, 2 ))) {
return WERR_NOMEM; return WERR_NOMEM;
} }
if (!(qlines[0] = talloc_strdup(qlines, SAMBA_PRINTER_PORT_NAME ))) { 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) { if (numlines) {
info = TALLOC_ARRAY(mem_ctx, union spoolss_PortInfo, numlines); info = talloc_array(mem_ctx, union spoolss_PortInfo, numlines);
if (!info) { if (!info) {
DEBUG(10,("Returning WERR_NOMEM\n")); DEBUG(10,("Returning WERR_NOMEM\n"));
result = WERR_NOMEM; result = WERR_NOMEM;
@ -7745,7 +7745,7 @@ static WERROR enumports_level_2(TALLOC_CTX *mem_ctx,
} }
if (numlines) { if (numlines) {
info = TALLOC_ARRAY(mem_ctx, union spoolss_PortInfo, numlines); info = talloc_array(mem_ctx, union spoolss_PortInfo, numlines);
if (!info) { if (!info) {
DEBUG(10,("Returning WERR_NOMEM\n")); DEBUG(10,("Returning WERR_NOMEM\n"));
result = WERR_NOMEM; result = WERR_NOMEM;
@ -8672,7 +8672,7 @@ static WERROR enumprintprocessors_level_1(TALLOC_CTX *mem_ctx,
union spoolss_PrintProcessorInfo *info; union spoolss_PrintProcessorInfo *info;
WERROR result; 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); W_ERROR_HAVE_NO_MEMORY(info);
*count = 1; *count = 1;
@ -8774,7 +8774,7 @@ static WERROR enumprintprocdatatypes_level_1(TALLOC_CTX *mem_ctx,
WERROR result; WERROR result;
union spoolss_PrintProcDataTypesInfo *info; 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); W_ERROR_HAVE_NO_MEMORY(info);
*count = 1; *count = 1;
@ -8890,7 +8890,7 @@ static WERROR enumprintmonitors_level_1(TALLOC_CTX *mem_ctx,
union spoolss_MonitorInfo *info; union spoolss_MonitorInfo *info;
WERROR result = WERR_OK; 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); W_ERROR_HAVE_NO_MEMORY(info);
*count = 2; *count = 2;
@ -8930,7 +8930,7 @@ static WERROR enumprintmonitors_level_2(TALLOC_CTX *mem_ctx,
union spoolss_MonitorInfo *info; union spoolss_MonitorInfo *info;
WERROR result = WERR_OK; 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); W_ERROR_HAVE_NO_MEMORY(info);
*count = 2; *count = 2;

View File

@ -449,7 +449,7 @@ static WERROR winreg_printer_enumvalues(TALLOC_CTX *mem_ctx,
return WERR_OK; 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) { if (enum_values == NULL) {
result = WERR_NOMEM; result = WERR_NOMEM;
goto error; goto error;
@ -3084,7 +3084,7 @@ WERROR winreg_printer_enumforms1(TALLOC_CTX *mem_ctx,
goto done; 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) { if (info == NULL) {
result = WERR_NOMEM; result = WERR_NOMEM;
goto done; goto done;

View File

@ -71,7 +71,7 @@ bool init_service_op_table( void )
int num_services = SVCCTL_NUM_INTERNAL_SERVICES + str_list_length( service_list ); int num_services = SVCCTL_NUM_INTERNAL_SERVICES + str_list_length( service_list );
int i; 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")); DEBUG(0,("init_service_op_table: talloc() failed!\n"));
return False; return False;
} }
@ -421,7 +421,7 @@ static int enumerate_status(TALLOC_CTX *ctx,
while ( svcctl_ops[num_services].name ) while ( svcctl_ops[num_services].name )
num_services++; 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")); DEBUG(0,("enumerate_status: talloc() failed!\n"));
return -1; return -1;
} }

View File

@ -542,7 +542,7 @@ WERROR _winreg_InitiateSystemShutdownEx(struct pipes_struct *p,
if ( (msg = talloc_strdup(p->mem_ctx, r->in.message->string )) == NULL ) { if ( (msg = talloc_strdup(p->mem_ctx, r->in.message->string )) == NULL ) {
return WERR_NOMEM; 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) { if (!chkmsg) {
return WERR_NOMEM; return WERR_NOMEM;
} }

View File

@ -400,7 +400,7 @@ static NTSTATUS cmd_lsa_lookup_sids(struct rpc_pipe_client *cli, TALLOC_CTX *mem
/* Convert arguments to sids */ /* 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) { if (!sids) {
printf("could not allocate memory for %d sids\n", argc - 1); 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; goto done;
rights.count = argc-2; rights.count = argc-2;
rights.names = TALLOC_ARRAY(mem_ctx, struct lsa_StringLarge, rights.names = talloc_array(mem_ctx, struct lsa_StringLarge,
rights.count); rights.count);
if (!rights.names) { if (!rights.names) {
return NT_STATUS_NO_MEMORY; return NT_STATUS_NO_MEMORY;
@ -1036,7 +1036,7 @@ static NTSTATUS cmd_lsa_remove_acct_rights(struct rpc_pipe_client *cli,
goto done; goto done;
rights.count = argc-2; rights.count = argc-2;
rights.names = TALLOC_ARRAY(mem_ctx, struct lsa_StringLarge, rights.names = talloc_array(mem_ctx, struct lsa_StringLarge,
rights.count); rights.count);
if (!rights.names) { if (!rights.names) {
return NT_STATUS_NO_MEMORY; return NT_STATUS_NO_MEMORY;

View File

@ -2087,7 +2087,7 @@ static NTSTATUS cmd_samr_lookup_names(struct rpc_pipe_client *cli,
num_names = argc - 2; 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, &domain_pol, &result);
dcerpc_samr_Close(b, mem_ctx, &connect_pol, &result); dcerpc_samr_Close(b, mem_ctx, &connect_pol, &result);
status = NT_STATUS_NO_MEMORY; status = NT_STATUS_NO_MEMORY;
@ -2167,7 +2167,7 @@ static NTSTATUS cmd_samr_lookup_rids(struct rpc_pipe_client *cli,
num_rids = argc - 2; 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, &domain_pol, &result);
dcerpc_samr_Close(b, mem_ctx, &connect_pol, &result); dcerpc_samr_Close(b, mem_ctx, &connect_pol, &result);
status = NT_STATUS_NO_MEMORY; status = NT_STATUS_NO_MEMORY;

View File

@ -742,7 +742,7 @@ void reply_trans(struct smb_request *req)
goto bad_param; goto bad_param;
} }
if((state->setup = TALLOC_ARRAY( if((state->setup = talloc_array(
state, uint16, state->setup_count)) == NULL) { state, uint16, state->setup_count)) == NULL) {
DEBUG(0,("reply_trans: setup malloc fail for %u " DEBUG(0,("reply_trans: setup malloc fail for %u "
"bytes !\n", (unsigned int) "bytes !\n", (unsigned int)

View File

@ -364,7 +364,7 @@ static bool parse_msdfs_symlink(TALLOC_CTX *ctx,
return False; return False;
} }
alt_path = TALLOC_ARRAY(ctx, char *, MAX_REFERRAL_COUNT); alt_path = talloc_array(ctx, char *, MAX_REFERRAL_COUNT);
if (!alt_path) { if (!alt_path) {
return False; return False;
} }
@ -443,7 +443,7 @@ static bool is_msdfs_link_internal(TALLOC_CTX *ctx,
if (pp_link_target) { if (pp_link_target) {
bufsize = 1024; bufsize = 1024;
link_target = TALLOC_ARRAY(ctx, char, bufsize); link_target = talloc_array(ctx, char, bufsize);
if (!link_target) { if (!link_target) {
return False; return False;
} }
@ -1736,7 +1736,7 @@ struct junction_map *enum_msdfs_links(struct smbd_server_connection *sconn,
if (jn_count == 0) { if (jn_count == 0) {
return NULL; return NULL;
} }
jn = TALLOC_ARRAY(ctx, struct junction_map, jn_count); jn = talloc_array(ctx, struct junction_map, jn_count);
if (!jn) { if (!jn) {
return NULL; return NULL;
} }

View File

@ -3124,7 +3124,7 @@ NTSTATUS open_streams_for_delete(connection_struct *conn,
return NT_STATUS_OK; 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) { if (streams == NULL) {
DEBUG(0, ("talloc failed\n")); DEBUG(0, ("talloc failed\n"));
status = NT_STATUS_NO_MEMORY; status = NT_STATUS_NO_MEMORY;
@ -3637,7 +3637,7 @@ NTSTATUS get_relative_fid_filename(connection_struct *conn,
* Copy in the base directory name. * Copy in the base directory name.
*/ */
parent_fname = TALLOC_ARRAY(talloc_tos(), char, parent_fname = talloc_array(talloc_tos(), char,
dir_name_len+2); dir_name_len+2);
if (parent_fname == NULL) { if (parent_fname == NULL) {
status = NT_STATUS_NO_MEMORY; status = NT_STATUS_NO_MEMORY;

View File

@ -224,7 +224,7 @@ bool should_notify_deferred_opens()
static char *new_break_message_smb1(TALLOC_CTX *mem_ctx, static char *new_break_message_smb1(TALLOC_CTX *mem_ctx,
files_struct *fsp, int cmd) 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) { if (result == NULL) {
DEBUG(0, ("talloc failed\n")); DEBUG(0, ("talloc failed\n"));

View File

@ -346,7 +346,7 @@ static NTSTATUS receive_smb_raw_talloc_partial_read(TALLOC_CTX *mem_ctx,
* talloc and return. * talloc and return.
*/ */
*buffer = TALLOC_ARRAY(mem_ctx, char, len+4); *buffer = talloc_array(mem_ctx, char, len+4);
if (*buffer == NULL) { if (*buffer == NULL) {
DEBUG(0, ("Could not allocate inbuf of length %d\n", 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. * 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) { if (*buffer == NULL) {
DEBUG(0, ("Could not allocate inbuf of length %d\n", 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); smb_panic(msg);
} }
*outbuf = TALLOC_ARRAY(mem_ctx, char, *outbuf = talloc_array(mem_ctx, char,
smb_size + num_words*2 + num_bytes); smb_size + num_words*2 + num_bytes);
if (*outbuf == NULL) { if (*outbuf == NULL) {
return false; return false;

View File

@ -3094,9 +3094,9 @@ static void send_file_readbraw(connection_struct *conn,
normal_readbraw: normal_readbraw:
outbuf = TALLOC_ARRAY(NULL, char, nread+4); outbuf = talloc_array(NULL, char, nread+4);
if (!outbuf) { 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))); (unsigned)(nread+4)));
reply_readbraw_error(sconn); reply_readbraw_error(sconn);
return; return;
@ -4018,7 +4018,7 @@ void reply_writebraw(struct smb_request *req)
total_written = nwritten; total_written = nwritten;
/* Allocate a buffer of 64k + length. */ /* Allocate a buffer of 64k + length. */
buf = TALLOC_ARRAY(NULL, char, 65540); buf = talloc_array(NULL, char, 65540);
if (!buf) { if (!buf) {
reply_nterror(req, NT_STATUS_NO_MEMORY); reply_nterror(req, NT_STATUS_NO_MEMORY);
error_to_writebrawerr(req); error_to_writebrawerr(req);

View File

@ -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. * 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) { if (names == NULL) {
DEBUG(0, ("talloc failed\n")); DEBUG(0, ("talloc failed\n"));
return NT_STATUS_NO_MEMORY; return NT_STATUS_NO_MEMORY;
@ -4768,7 +4768,7 @@ NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
case SMB_QUERY_FILE_UNIX_LINK: case SMB_QUERY_FILE_UNIX_LINK:
{ {
int len; int len;
char *buffer = TALLOC_ARRAY(mem_ctx, char, PATH_MAX+1); char *buffer = talloc_array(mem_ctx, char, PATH_MAX+1);
if (!buffer) { if (!buffer) {
return NT_STATUS_NO_MEMORY; return NT_STATUS_NO_MEMORY;

View File

@ -57,7 +57,7 @@ static NTSTATUS cmd_populate(struct vfs_state *vfs, TALLOC_CTX *mem_ctx, int arg
} }
c = argv[1][0]; c = argv[1][0];
size = atoi(argv[2]); size = atoi(argv[2]);
vfs->data = TALLOC_ARRAY(mem_ctx, char, size); vfs->data = talloc_array(mem_ctx, char, size);
if (vfs->data == NULL) { if (vfs->data == NULL) {
printf("populate: error=-1 (not enough memory)"); printf("populate: error=-1 (not enough memory)");
return NT_STATUS_UNSUCCESSFUL; 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 */ /* do some error checking on these */
fd = atoi(argv[1]); fd = atoi(argv[1]);
size = atoi(argv[2]); size = atoi(argv[2]);
vfs->data = TALLOC_ARRAY(mem_ctx, char, size); vfs->data = talloc_array(mem_ctx, char, size);
if (vfs->data == NULL) { if (vfs->data == NULL) {
printf("read: error=-1 (not enough memory)"); printf("read: error=-1 (not enough memory)");
return NT_STATUS_UNSUCCESSFUL; return NT_STATUS_UNSUCCESSFUL;

View File

@ -386,8 +386,8 @@ static void test_mask(int argc, char *argv[],
while (1) { while (1) {
l1 = 1 + random() % 20; l1 = 1 + random() % 20;
l2 = 1 + random() % 20; l2 = 1 + random() % 20;
mask = 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); file = talloc_array(ctx, char, strlen("\\masktest\\")+1+22);
if (!mask || !file) { if (!mask || !file) {
goto finished; goto finished;
} }

View File

@ -8204,7 +8204,7 @@ static bool run_local_wbclient(int dummy)
goto fail; goto fail;
} }
wb_ctx = TALLOC_ARRAY(ev, struct wb_context *, nprocs); wb_ctx = talloc_array(ev, struct wb_context *, nprocs);
if (wb_ctx == NULL) { if (wb_ctx == NULL) {
goto fail; goto fail;
} }

View File

@ -171,7 +171,7 @@ static bool eventlog_add_source( const char *eventlog, const char *sourcename,
if ( !already_in ) { if ( !already_in ) {
/* make a new list with an additional entry; copy values, add another */ /* 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 ) { if ( !wp ) {
d_printf("talloc() failed \n"); d_printf("talloc() failed \n");

View File

@ -333,8 +333,8 @@ static NTSTATUS registry_enumvalues(TALLOC_CTX *ctx,
return NT_STATUS_OK; return NT_STATUS_OK;
} }
if ((!(names = TALLOC_ARRAY(mem_ctx, char *, num_values))) || if ((!(names = talloc_array(mem_ctx, char *, num_values))) ||
(!(values = TALLOC_ARRAY(mem_ctx, struct registry_value *, (!(values = talloc_array(mem_ctx, struct registry_value *,
num_values)))) { num_values)))) {
status = NT_STATUS_NO_MEMORY; status = NT_STATUS_NO_MEMORY;
goto error; goto error;
@ -456,8 +456,8 @@ static NTSTATUS registry_enumvalues2(TALLOC_CTX *ctx,
return NT_STATUS_OK; return NT_STATUS_OK;
} }
if ((!(names = TALLOC_ARRAY(mem_ctx, char *, num_values))) || if ((!(names = talloc_array(mem_ctx, char *, num_values))) ||
(!(values = TALLOC_ARRAY(mem_ctx, struct regval_blob *, (!(values = talloc_array(mem_ctx, struct regval_blob *,
num_values)))) { num_values)))) {
status = NT_STATUS_NO_MEMORY; status = NT_STATUS_NO_MEMORY;
goto error; goto error;

View File

@ -506,7 +506,7 @@ static NTSTATUS rpc_rights_grant_internal(struct net_context *c,
return status; return status;
rights.count = argc-1; rights.count = argc-1;
rights.names = TALLOC_ARRAY(mem_ctx, struct lsa_StringLarge, rights.names = talloc_array(mem_ctx, struct lsa_StringLarge,
rights.count); rights.count);
if (!rights.names) { if (!rights.names) {
return NT_STATUS_NO_MEMORY; return NT_STATUS_NO_MEMORY;
@ -579,7 +579,7 @@ static NTSTATUS rpc_rights_revoke_internal(struct net_context *c,
return status; return status;
rights.count = argc-1; rights.count = argc-1;
rights.names = TALLOC_ARRAY(mem_ctx, struct lsa_StringLarge, rights.names = talloc_array(mem_ctx, struct lsa_StringLarge,
rights.count); rights.count);
if (!rights.names) { if (!rights.names) {
return NT_STATUS_NO_MEMORY; return NT_STATUS_NO_MEMORY;

View File

@ -101,7 +101,7 @@ static const char *fix_quotes(TALLOC_CTX *ctx, char *str)
} }
++p; ++p;
} }
newstring = TALLOC_ARRAY(ctx, char, newstring_len); newstring = talloc_array(ctx, char, newstring_len);
if (!newstring) { if (!newstring) {
return ""; return "";
} }

View File

@ -401,7 +401,7 @@ struct idmap_domain *idmap_find_domain(const char *domname)
/* /*
* talloc context for all idmap domains * 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) { if (idmap_domains == NULL) {

View File

@ -781,10 +781,10 @@ done:
#endif #endif
if (count == 0) { 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); 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); BAIL_ON_PTR_ERROR(msg_tmp, nt_status);
} else { } else {
ads_tmp = talloc_realloc(*ads_list, *ads_list, ADS_STRUCT*, ads_tmp = talloc_realloc(*ads_list, *ads_list, ADS_STRUCT*,

View File

@ -128,7 +128,7 @@ struct tevent_req *wb_lookupsids_send(TALLOC_CTX *mem_ctx,
return tevent_req_post(req, ev); 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)) { if (tevent_req_nomem(state->single_sids, req)) {
return tevent_req_post(req, ev); 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)) { if (tevent_req_nomem(state->res_domains, req)) {
return tevent_req_post(req, ev); 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); state->res_domains, struct lsa_DomainInfo, num_sids);
if (tevent_req_nomem(state->res_domains->domains, req)) { if (tevent_req_nomem(state->res_domains->domains, req)) {
return tevent_req_post(req, ev); 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)) { if (tevent_req_nomem(state->res_names, req)) {
return tevent_req_post(req, ev); 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); state->res_names, struct lsa_TranslatedName, num_sids);
if (tevent_req_nomem(state->res_names->names, req)) { if (tevent_req_nomem(state->res_names->names, req)) {
return tevent_req_post(req, ev); 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)) { if (sid_check_is_domain(&d->sid)) {
state->rids.num_rids = d->sids.num_sids; 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); state->rids.num_rids);
if (tevent_req_nomem(state->rids.rids, req)) { if (tevent_req_nomem(state->rids.rids, req)) {
return false; return false;
@ -337,13 +337,13 @@ static struct wb_lookupsids_domain *wb_lookupsids_get_domain(
sid_split_rid(&domain->sid, NULL); sid_split_rid(&domain->sid, NULL);
domain->domain = wb_domain; 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) { if (domains->sids.sids == NULL) {
goto fail; goto fail;
} }
domain->sids.num_sids = 0; 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) { if (domain->sid_indexes == NULL) {
TALLOC_FREE(domain->sids.sids); TALLOC_FREE(domain->sids.sids);
goto fail; goto fail;

View File

@ -309,7 +309,7 @@ static char *centry_string(struct cache_entry *centry, TALLOC_CTX *mem_ctx)
smb_panic_fn("centry_string"); smb_panic_fn("centry_string");
} }
ret = TALLOC_ARRAY(mem_ctx, char, len+1); ret = talloc_array(mem_ctx, char, len+1);
if (!ret) { if (!ret) {
smb_panic_fn("centry_string out of memory\n"); 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; return NULL;
} }
ret = TALLOC_ARRAY(mem_ctx, char, 16); ret = talloc_array(mem_ctx, char, 16);
if (!ret) { if (!ret) {
smb_panic_fn("centry_hash out of memory\n"); smb_panic_fn("centry_hash out of memory\n");
} }
@ -1436,7 +1436,7 @@ do_fetch_cache:
if (*num_entries == 0) if (*num_entries == 0)
goto do_cached; 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)) { if (! (*info)) {
smb_panic_fn("query_user_list out of memory"); smb_panic_fn("query_user_list out of memory");
} }
@ -1588,7 +1588,7 @@ do_fetch_cache:
if (*num_entries == 0) if (*num_entries == 0)
goto do_cached; 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)) { if (! (*info)) {
smb_panic_fn("enum_dom_groups out of memory"); smb_panic_fn("enum_dom_groups out of memory");
} }
@ -1683,7 +1683,7 @@ do_fetch_cache:
if (*num_entries == 0) if (*num_entries == 0)
goto do_cached; 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)) { if (! (*info)) {
smb_panic_fn("enum_dom_groups out of memory"); 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; return NT_STATUS_OK;
} }
*names = TALLOC_ARRAY(mem_ctx, char *, num_rids); *names = talloc_array(mem_ctx, 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)) { if ((*names == NULL) || (*types == NULL)) {
result = NT_STATUS_NO_MEMORY; 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 ( !set_only ) {
if ( !*domains ) { if ( !*domains ) {
list = TALLOC_ARRAY( NULL, struct winbindd_tdc_domain, 1 ); list = talloc_array( NULL, struct winbindd_tdc_domain, 1 );
idx = 0; idx = 0;
} else { } else {
list = talloc_realloc( *domains, *domains, list = talloc_realloc( *domains, *domains,
@ -4346,7 +4346,7 @@ static size_t unpack_tdc_domains( unsigned char *buf, int buflen,
return 0; return 0;
} }
list = TALLOC_ARRAY( NULL, struct winbindd_tdc_domain, num_domains ); list = talloc_array( NULL, struct winbindd_tdc_domain, num_domains );
if ( !list ) { if ( !list ) {
DEBUG(0,("unpack_tdc_domains: Failed to talloc() domain list!\n")); DEBUG(0,("unpack_tdc_domains: Failed to talloc() domain list!\n"));
return 0; return 0;

View File

@ -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 )); DEBUG(3, ("msrpc_rids_to_names: domain %s\n", domain->name ));
if (num_rids) { 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) { if (sids == NULL) {
return NT_STATUS_NO_MEMORY; return NT_STATUS_NO_MEMORY;
} }

View File

@ -404,7 +404,7 @@ NTSTATUS rpc_rids_to_names(TALLOC_CTX *mem_ctx,
NTSTATUS status; NTSTATUS status;
if (num_rids > 0) { 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) { if (sids == NULL) {
return NT_STATUS_NO_MEMORY; return NT_STATUS_NO_MEMORY;
} }
@ -594,7 +594,7 @@ NTSTATUS rpc_lookup_usergroups(TALLOC_CTX *mem_ctx,
return result; 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) { if (user_grpsids == NULL) {
status = NT_STATUS_NO_MEMORY; status = NT_STATUS_NO_MEMORY;
return status; return status;

View File

@ -85,7 +85,7 @@ struct tevent_req *winbindd_sids_to_xids_send(TALLOC_CTX *mem_ctx,
if (tevent_req_nomem(state->cached, req)) { if (tevent_req_nomem(state->cached, req)) {
return tevent_req_post(req, ev); 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); state->num_sids);
if (tevent_req_nomem(state->non_cached, req)) { if (tevent_req_nomem(state->non_cached, req)) {
return tevent_req_post(req, ev); 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.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); state->num_non_cached);
if (tevent_req_nomem(state->ids.ids, req)) { if (tevent_req_nomem(state->ids.ids, req)) {
return; return;

View File

@ -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 (NT_STATUS_IS_OK(resolve_wins(name,0x20,&ret,count))) {
if ( *count == 0 ) if ( *count == 0 )
return NULL; return NULL;
return_ss = TALLOC_ARRAY(mem_ctx, struct sockaddr_storage, return_ss = talloc_array(mem_ctx, struct sockaddr_storage,
*count); *count);
if (return_ss == NULL ) { if (return_ss == NULL ) {
free( ret ); free( ret );