1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

s3-talloc Change TALLOC_ZERO_ARRAY() to talloc_zero_array()

Using the standard macro makes it easier to move code into common, as
TALLOC_ZERO_ARRAY isn't standard talloc.
This commit is contained in:
Andrew Bartlett 2011-06-07 11:58:39 +10:00
parent ad0a07c531
commit 5e26e94092
40 changed files with 98 additions and 99 deletions

View File

@ -59,7 +59,7 @@ static int test_get_shadow_copy_data(vfs_handle_struct *handle, files_struct *fs
if (labels) {
if (num) {
shadow_copy_data->labels = TALLOC_ZERO_ARRAY(shadow_copy_data->mem_ctx,SHADOW_COPY_LABEL,num);
shadow_copy_data->labels = talloc_zero_array(shadow_copy_data->mem_ctx,SHADOW_COPY_LABEL,num);
} else {
shadow_copy_data->labels = NULL;
}

View File

@ -1606,7 +1606,7 @@ static int cmd_altname(void)
static char *attr_str(TALLOC_CTX *mem_ctx, uint16_t mode)
{
char *attrs = TALLOC_ZERO_ARRAY(mem_ctx, char, 17);
char *attrs = talloc_zero_array(mem_ctx, char, 17);
int i = 0;
if (!(mode & FILE_ATTRIBUTE_NORMAL)) {

View File

@ -221,7 +221,6 @@ copy an IP address from one buffer to another
#define TALLOC(ctx, size) talloc_named_const(ctx, 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_ARRAY(ctx, type, count) (type *)_talloc_zero_array(ctx, sizeof(type), count, #type)
#define TALLOC_SIZE(ctx, size) talloc_named_const(ctx, size, __location__)
#define TALLOC_ZERO_SIZE(ctx, size) _talloc_zero(ctx, size, __location__)

View File

@ -34,7 +34,7 @@ struct bitmap *bitmap_talloc(TALLOC_CTX *mem_ctx, int n)
if (!bm) return NULL;
bm->n = n;
bm->b = TALLOC_ZERO_ARRAY(bm, uint32, (n+31)/32);
bm->b = talloc_zero_array(bm, uint32, (n+31)/32);
if (!bm->b) {
TALLOC_FREE(bm);
return NULL;

View File

@ -188,7 +188,7 @@ static NTSTATUS pipe_cm_connect(TALLOC_CTX *mem_ctx,
struct client_pipe_connection *p;
NTSTATUS status;
p = TALLOC_ZERO_ARRAY(mem_ctx, struct client_pipe_connection, 1);
p = talloc_zero_array(mem_ctx, struct client_pipe_connection, 1);
if (!p) {
return NT_STATUS_NO_MEMORY;
}

View File

@ -1157,7 +1157,7 @@ static WERROR convert_samr_disp_groups_to_GROUP_INFO_0_buffer(TALLOC_CTX *mem_ct
struct GROUP_INFO_0 *g0;
int i;
g0 = TALLOC_ZERO_ARRAY(mem_ctx, struct GROUP_INFO_0, groups->count);
g0 = talloc_zero_array(mem_ctx, struct GROUP_INFO_0, groups->count);
W_ERROR_HAVE_NO_MEMORY(g0);
for (i=0; i<groups->count; i++) {
@ -1183,7 +1183,7 @@ static WERROR convert_samr_disp_groups_to_GROUP_INFO_1_buffer(TALLOC_CTX *mem_ct
struct GROUP_INFO_1 *g1;
int i;
g1 = TALLOC_ZERO_ARRAY(mem_ctx, struct GROUP_INFO_1, groups->count);
g1 = talloc_zero_array(mem_ctx, struct GROUP_INFO_1, groups->count);
W_ERROR_HAVE_NO_MEMORY(g1);
for (i=0; i<groups->count; i++) {
@ -1211,7 +1211,7 @@ static WERROR convert_samr_disp_groups_to_GROUP_INFO_2_buffer(TALLOC_CTX *mem_ct
struct GROUP_INFO_2 *g2;
int i;
g2 = TALLOC_ZERO_ARRAY(mem_ctx, struct GROUP_INFO_2, groups->count);
g2 = talloc_zero_array(mem_ctx, struct GROUP_INFO_2, groups->count);
W_ERROR_HAVE_NO_MEMORY(g2);
for (i=0; i<groups->count; i++) {
@ -1242,7 +1242,7 @@ static WERROR convert_samr_disp_groups_to_GROUP_INFO_3_buffer(TALLOC_CTX *mem_ct
struct GROUP_INFO_3 *g3;
int i;
g3 = TALLOC_ZERO_ARRAY(mem_ctx, struct GROUP_INFO_3, groups->count);
g3 = talloc_zero_array(mem_ctx, struct GROUP_INFO_3, groups->count);
W_ERROR_HAVE_NO_MEMORY(g3);
for (i=0; i<groups->count; i++) {

View File

@ -1115,7 +1115,7 @@ static WERROR NetLocalGroupModifyMembers_r(struct libnetapi_ctx *ctx,
ZERO_STRUCT(domain_handle);
ZERO_STRUCT(alias_handle);
member_sids = TALLOC_ZERO_ARRAY(ctx, struct dom_sid,
member_sids = talloc_zero_array(ctx, struct dom_sid,
r->in.total_entries);
W_ERROR_HAVE_NO_MEMORY(member_sids);

View File

@ -1436,7 +1436,7 @@ static WERROR convert_samr_dispinfo_to_NET_DISPLAY_USER(TALLOC_CTX *mem_ctx,
struct NET_DISPLAY_USER *user = NULL;
int i;
user = TALLOC_ZERO_ARRAY(mem_ctx,
user = talloc_zero_array(mem_ctx,
struct NET_DISPLAY_USER,
info->count);
W_ERROR_HAVE_NO_MEMORY(user);
@ -1480,7 +1480,7 @@ static WERROR convert_samr_dispinfo_to_NET_DISPLAY_MACHINE(TALLOC_CTX *mem_ctx,
struct NET_DISPLAY_MACHINE *machine = NULL;
int i;
machine = TALLOC_ZERO_ARRAY(mem_ctx,
machine = talloc_zero_array(mem_ctx,
struct NET_DISPLAY_MACHINE,
info->count);
W_ERROR_HAVE_NO_MEMORY(machine);
@ -1522,7 +1522,7 @@ static WERROR convert_samr_dispinfo_to_NET_DISPLAY_GROUP(TALLOC_CTX *mem_ctx,
struct NET_DISPLAY_GROUP *group = NULL;
int i;
group = TALLOC_ZERO_ARRAY(mem_ctx,
group = talloc_zero_array(mem_ctx,
struct NET_DISPLAY_GROUP,
info->count);
W_ERROR_HAVE_NO_MEMORY(group);

View File

@ -1521,7 +1521,7 @@ int poll_one_fd(int fd, int events, int timeout, int *revents)
int ret;
int saved_errno;
fds = TALLOC_ZERO_ARRAY(talloc_tos(), struct pollfd, 2);
fds = talloc_zero_array(talloc_tos(), struct pollfd, 2);
if (fds == NULL) {
errno = ENOMEM;
return -1;

View File

@ -442,7 +442,7 @@ static NTSTATUS ads_dns_lookup_srv( TALLOC_CTX *ctx,
answer_count));
if (answer_count) {
if ((dcs = TALLOC_ZERO_ARRAY(ctx, struct dns_rr_srv,
if ((dcs = talloc_zero_array(ctx, struct dns_rr_srv,
answer_count)) == NULL ) {
DEBUG(0,("ads_dns_lookup_srv: "
"talloc() failure for %d char*'s\n",

View File

@ -807,7 +807,7 @@ static struct berval **ads_dup_values(TALLOC_CTX *ctx,
if (!in_vals) return NULL;
for (i=0; in_vals[i]; i++)
; /* count values */
values = TALLOC_ZERO_ARRAY(ctx, struct berval *, i+1);
values = talloc_zero_array(ctx, struct berval *, i+1);
if (!values) return NULL;
for (i=0; in_vals[i]; i++) {
@ -828,7 +828,7 @@ static char **ads_push_strvals(TALLOC_CTX *ctx, const char **in_vals)
if (!in_vals) return NULL;
for (i=0; in_vals[i]; i++)
; /* count values */
values = TALLOC_ZERO_ARRAY(ctx, char *, i+1);
values = talloc_zero_array(ctx, char *, i+1);
if (!values) return NULL;
for (i=0; in_vals[i]; i++) {
@ -852,7 +852,7 @@ static char **ads_pull_strvals(TALLOC_CTX *ctx, const char **in_vals)
if (!in_vals) return NULL;
for (i=0; in_vals[i]; i++)
; /* count values */
values = TALLOC_ZERO_ARRAY(ctx, char *, i+1);
values = talloc_zero_array(ctx, char *, i+1);
if (!values) return NULL;
for (i=0; in_vals[i]; i++) {
@ -1385,7 +1385,7 @@ ADS_MODLIST ads_init_mods(TALLOC_CTX *ctx)
#define ADS_MODLIST_ALLOC_SIZE 10
LDAPMod **mods;
if ((mods = TALLOC_ZERO_ARRAY(ctx, LDAPMod *, ADS_MODLIST_ALLOC_SIZE + 1)))
if ((mods = talloc_zero_array(ctx, LDAPMod *, ADS_MODLIST_ALLOC_SIZE + 1)))
/* -1 is safety to make sure we don't go over the end.
need to reset it to NULL before doing ldap modify */
mods[ADS_MODLIST_ALLOC_SIZE] = (LDAPMod *) -1;
@ -3287,7 +3287,7 @@ ADS_STATUS ads_get_sid_from_extended_dn(TALLOC_CTX *mem_ctx,
return 0;
}
(*sids) = TALLOC_ZERO_ARRAY(mem_ctx, struct dom_sid, dn_count + 1);
(*sids) = talloc_zero_array(mem_ctx, struct dom_sid, dn_count + 1);
if (!(*sids)) {
TALLOC_FREE(dn_strings);
return 0;

View File

@ -993,8 +993,8 @@ static NTSTATUS ldif_init_context(TALLOC_CTX *mem_ctx,
}
/* Allocate initial memory for groupmap and accountmap arrays */
r->groupmap = TALLOC_ZERO_ARRAY(mem_ctx, GROUPMAP, 8);
r->accountmap = TALLOC_ZERO_ARRAY(mem_ctx, ACCOUNTMAP, 8);
r->groupmap = talloc_zero_array(mem_ctx, GROUPMAP, 8);
r->accountmap = talloc_zero_array(mem_ctx, ACCOUNTMAP, 8);
if (r->groupmap == NULL || r->accountmap == NULL) {
DEBUG(1,("GROUPMAP talloc failed\n"));
status = NT_STATUS_NO_MEMORY;

View File

@ -476,7 +476,7 @@ static NTSTATUS fetch_group_mem_info(TALLOC_CTX *mem_ctx,
d_printf("Group members of %s: ", grp->gr_name);
if (r->num_rids) {
if ((nt_members = TALLOC_ZERO_ARRAY(mem_ctx, char *, r->num_rids)) == NULL) {
if ((nt_members = talloc_zero_array(mem_ctx, char *, r->num_rids)) == NULL) {
DEBUG(0, ("talloc failed\n"));
return NT_STATUS_NO_MEMORY;
}

View File

@ -161,7 +161,7 @@ struct tevent_req *cli_setpathinfo_send(TALLOC_CTX *mem_ctx,
SSVAL(&state->setup, 0, TRANSACT2_SETPATHINFO);
/* Setup param array. */
state->param = TALLOC_ZERO_ARRAY(state, uint8_t, 6);
state->param = talloc_zero_array(state, uint8_t, 6);
if (tevent_req_nomem(state->param, req)) {
return tevent_req_post(req, ev);
}

View File

@ -467,7 +467,7 @@ struct tevent_req *cli_pull_send(TALLOC_CTX *mem_ctx,
state->num_reqs = MAX(window_size/state->chunk_size, 1);
state->num_reqs = MIN(state->num_reqs, cli->max_mux);
state->reqs = TALLOC_ZERO_ARRAY(state, struct cli_pull_subreq,
state->reqs = talloc_zero_array(state, struct cli_pull_subreq,
state->num_reqs);
if (state->reqs == NULL) {
goto failed;
@ -1149,7 +1149,7 @@ struct tevent_req *cli_push_send(TALLOC_CTX *mem_ctx, struct event_context *ev,
state->num_reqs = MIN(state->num_reqs, cli->max_mux);
state->num_reqs = MAX(state->num_reqs, 1);
state->reqs = TALLOC_ZERO_ARRAY(state, struct cli_push_write_state *,
state->reqs = talloc_zero_array(state, struct cli_push_write_state *,
state->num_reqs);
if (state->reqs == NULL) {
goto failed;

View File

@ -498,7 +498,7 @@ static NTSTATUS discover_dc_netbios(TALLOC_CTX *mem_ctx,
return status;
}
dclist = TALLOC_ZERO_ARRAY(mem_ctx, struct ip_service_name, count);
dclist = talloc_zero_array(mem_ctx, struct ip_service_name, count);
if (!dclist) {
SAFE_FREE(iplist);
return NT_STATUS_NO_MEMORY;
@ -579,7 +579,7 @@ static NTSTATUS discover_dc_dns(TALLOC_CTX *mem_ctx,
numaddrs += MAX(dcs[i].num_ips,1);
}
dclist = TALLOC_ZERO_ARRAY(mem_ctx,
dclist = talloc_zero_array(mem_ctx,
struct ip_service_name,
numaddrs);
if (!dclist) {

View File

@ -208,13 +208,13 @@ bool enumerate_domain_trusts( TALLOC_CTX *mem_ctx, const char *domain,
*num_domains = dom_list.count;
*domain_names = TALLOC_ZERO_ARRAY(mem_ctx, char *, *num_domains);
*domain_names = talloc_zero_array(mem_ctx, char *, *num_domains);
if (!*domain_names) {
status = NT_STATUS_NO_MEMORY;
goto done;
}
*sids = TALLOC_ZERO_ARRAY(mem_ctx, struct dom_sid, *num_domains);
*sids = talloc_zero_array(mem_ctx, struct dom_sid, *num_domains);
if (!*sids) {
status = NT_STATUS_NO_MEMORY;
goto done;

View File

@ -179,7 +179,7 @@ static void add_directory_inheritable_components(vfs_handle_struct *handle,
mode_t dir_mode;
mode_t file_mode;
mode_t mode;
struct security_ace *new_ace_list = TALLOC_ZERO_ARRAY(talloc_tos(),
struct security_ace *new_ace_list = talloc_zero_array(talloc_tos(),
struct security_ace,
num_aces + 3);

View File

@ -1707,7 +1707,7 @@ static bool create_listen_pollfds(struct pollfd **pfds,
}
}
fds = TALLOC_ZERO_ARRAY(NULL, struct pollfd, count);
fds = talloc_zero_array(NULL, struct pollfd, count);
if (fds == NULL) {
DEBUG(1, ("create_listen_pollfds: malloc fail for fds. "
"size %d\n", count));

View File

@ -482,7 +482,7 @@ static bool lookup_rids(TALLOC_CTX *mem_ctx, const struct dom_sid *domain_sid,
sid_string_dbg(domain_sid)));
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);
if ((*names == NULL) || (*types == NULL)) {
@ -759,7 +759,7 @@ NTSTATUS lookup_sids(TALLOC_CTX *mem_ctx, int num_sids,
name_infos = NULL;
}
dom_infos = TALLOC_ZERO_ARRAY(mem_ctx, struct lsa_dom_info,
dom_infos = talloc_zero_array(mem_ctx, struct lsa_dom_info,
LSA_REF_DOMAIN_LIST_MULTIPLIER);
if (dom_infos == NULL) {
result = NT_STATUS_NO_MEMORY;

View File

@ -1518,7 +1518,7 @@ static NTSTATUS pdb_default_enum_group_members(struct pdb_methods *methods,
if (num_uids == 0)
return NT_STATUS_OK;
*pp_member_rids = TALLOC_ZERO_ARRAY(mem_ctx, uint32_t, num_uids);
*pp_member_rids = talloc_zero_array(mem_ctx, uint32_t, num_uids);
for (i=0; i<num_uids; i++) {
struct dom_sid sid;

View File

@ -945,7 +945,7 @@ static bool _reg_perfcount_init_data_block(struct PERF_DATA_BLOCK *block,
memset(temp, 0, sizeof(temp));
rpcstr_push((void *)temp, global_myname(), sizeof(temp), STR_TERMINATE);
block->SystemNameLength = (strlen_w(temp) * 2) + 2;
block->data = TALLOC_ZERO_ARRAY(mem_ctx, uint8, block->SystemNameLength + (8 - (block->SystemNameLength % 8)));
block->data = talloc_zero_array(mem_ctx, uint8, block->SystemNameLength + (8 - (block->SystemNameLength % 8)));
if (block->data == NULL) {
return False;
}

View File

@ -1898,7 +1898,7 @@ static int hashrec_cmp( REGF_HASH_REC *h1, REGF_HASH_REC *h2 )
nk->subkeys.num_keys = nk->num_subkeys;
if (nk->subkeys.num_keys) {
if ( !(nk->subkeys.hashes = TALLOC_ZERO_ARRAY( file->mem_ctx, REGF_HASH_REC, nk->subkeys.num_keys )) )
if ( !(nk->subkeys.hashes = talloc_zero_array( file->mem_ctx, REGF_HASH_REC, nk->subkeys.num_keys )) )
return NULL;
} else {
nk->subkeys.hashes = NULL;

View File

@ -520,7 +520,7 @@ NTSTATUS _lsa_EnumTrustDom(struct pipes_struct *p,
return nt_status;
}
entries = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_DomainInfo, count);
entries = talloc_zero_array(p->mem_ctx, struct lsa_DomainInfo, count);
if (!entries) {
return NT_STATUS_NO_MEMORY;
}
@ -681,7 +681,7 @@ NTSTATUS _lsa_QueryInfoPolicy(struct pipes_struct *p,
info->audit_events.auditing_mode = true;
info->audit_events.count = LSA_AUDIT_NUM_CATEGORIES;
info->audit_events.settings = TALLOC_ZERO_ARRAY(p->mem_ctx,
info->audit_events.settings = talloc_zero_array(p->mem_ctx,
enum lsa_PolicyAuditPolicy,
info->audit_events.count);
if (!info->audit_events.settings) {
@ -1174,7 +1174,7 @@ NTSTATUS _lsa_LookupNames(struct pipes_struct *p,
}
if (num_entries) {
rids = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_TranslatedSid,
rids = talloc_zero_array(p->mem_ctx, struct lsa_TranslatedSid,
num_entries);
if (!rids) {
return NT_STATUS_NO_MEMORY;
@ -1316,7 +1316,7 @@ NTSTATUS _lsa_LookupNames3(struct pipes_struct *p,
}
if (num_entries) {
trans_sids = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_TranslatedSid3,
trans_sids = talloc_zero_array(p->mem_ctx, struct lsa_TranslatedSid3,
num_entries);
if (!trans_sids) {
return NT_STATUS_NO_MEMORY;
@ -2230,7 +2230,7 @@ NTSTATUS _lsa_EnumPrivs(struct pipes_struct *p,
return NT_STATUS_ACCESS_DENIED;
if (num_privs) {
entries = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_PrivEntry, num_privs);
entries = talloc_zero_array(p->mem_ctx, struct lsa_PrivEntry, num_privs);
if (!entries) {
return NT_STATUS_NO_MEMORY;
}
@ -2351,7 +2351,7 @@ NTSTATUS _lsa_EnumAccounts(struct pipes_struct *p,
}
if (num_entries - *r->in.resume_handle) {
sids = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_SidPtr,
sids = talloc_zero_array(p->mem_ctx, struct lsa_SidPtr,
num_entries - *r->in.resume_handle);
if (!sids) {
talloc_free(sid_list);
@ -3030,7 +3030,7 @@ static NTSTATUS init_lsa_right_set(TALLOC_CTX *mem_ctx,
if (num_priv) {
r->names = TALLOC_ZERO_ARRAY(mem_ctx, struct lsa_StringLarge,
r->names = talloc_zero_array(mem_ctx, struct lsa_StringLarge,
num_priv);
if (!r->names) {
return NT_STATUS_NO_MEMORY;
@ -3323,7 +3323,7 @@ NTSTATUS _lsa_EnumTrustedDomainsEx(struct pipes_struct *p,
return nt_status;
}
entries = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_TrustDomainInfoInfoEx,
entries = talloc_zero_array(p->mem_ctx, struct lsa_TrustDomainInfoInfoEx,
count);
if (!entries) {
return NT_STATUS_NO_MEMORY;

View File

@ -784,7 +784,7 @@ static NTSTATUS make_user_sam_entry_list(TALLOC_CTX *ctx,
return NT_STATUS_OK;
}
sam = TALLOC_ZERO_ARRAY(ctx, struct samr_SamEntry, num_entries);
sam = talloc_zero_array(ctx, struct samr_SamEntry, num_entries);
if (sam == NULL) {
DEBUG(0, ("make_user_sam_entry_list: TALLOC_ZERO failed!\n"));
return NT_STATUS_NO_MEMORY;
@ -938,7 +938,7 @@ static void make_group_sam_entry_list(TALLOC_CTX *ctx,
return;
}
sam = TALLOC_ZERO_ARRAY(ctx, struct samr_SamEntry, num_sam_entries);
sam = talloc_zero_array(ctx, struct samr_SamEntry, num_sam_entries);
if (sam == NULL) {
return;
}
@ -1120,7 +1120,7 @@ static NTSTATUS init_samr_dispinfo_1(TALLOC_CTX *ctx,
r->count = num_entries;
r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryGeneral, num_entries);
r->entries = talloc_zero_array(ctx, struct samr_DispEntryGeneral, num_entries);
if (!r->entries) {
return NT_STATUS_NO_MEMORY;
}
@ -1164,7 +1164,7 @@ static NTSTATUS init_samr_dispinfo_2(TALLOC_CTX *ctx,
r->count = num_entries;
r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryFull, num_entries);
r->entries = talloc_zero_array(ctx, struct samr_DispEntryFull, num_entries);
if (!r->entries) {
return NT_STATUS_NO_MEMORY;
}
@ -1205,7 +1205,7 @@ static NTSTATUS init_samr_dispinfo_3(TALLOC_CTX *ctx,
r->count = num_entries;
r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryFullGroup, num_entries);
r->entries = talloc_zero_array(ctx, struct samr_DispEntryFullGroup, num_entries);
if (!r->entries) {
return NT_STATUS_NO_MEMORY;
}
@ -1246,7 +1246,7 @@ static NTSTATUS init_samr_dispinfo_4(TALLOC_CTX *ctx,
r->count = num_entries;
r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryAscii, num_entries);
r->entries = talloc_zero_array(ctx, struct samr_DispEntryAscii, num_entries);
if (!r->entries) {
return NT_STATUS_NO_MEMORY;
}
@ -1282,7 +1282,7 @@ static NTSTATUS init_samr_dispinfo_5(TALLOC_CTX *ctx,
r->count = num_entries;
r->entries = TALLOC_ZERO_ARRAY(ctx, struct samr_DispEntryAscii, num_entries);
r->entries = talloc_zero_array(ctx, struct samr_DispEntryAscii, num_entries);
if (!r->entries) {
return NT_STATUS_NO_MEMORY;
}
@ -2050,7 +2050,7 @@ static bool make_samr_lookup_rids(TALLOC_CTX *ctx, uint32 num_names,
*lsa_name_array_p = NULL;
if (num_names != 0) {
lsa_name_array = TALLOC_ZERO_ARRAY(ctx, struct lsa_String, num_names);
lsa_name_array = talloc_zero_array(ctx, struct lsa_String, num_names);
if (!lsa_name_array) {
return false;
}
@ -2100,9 +2100,9 @@ NTSTATUS _samr_LookupRids(struct pipes_struct *p,
}
if (num_rids) {
names = TALLOC_ZERO_ARRAY(p->mem_ctx, const char *, num_rids);
attrs = TALLOC_ZERO_ARRAY(p->mem_ctx, enum lsa_SidType, num_rids);
wire_attrs = TALLOC_ZERO_ARRAY(p->mem_ctx, uint32, num_rids);
names = talloc_zero_array(p->mem_ctx, const char *, num_rids);
attrs = talloc_zero_array(p->mem_ctx, enum lsa_SidType, num_rids);
wire_attrs = talloc_zero_array(p->mem_ctx, uint32, num_rids);
if ((names == NULL) || (attrs == NULL) || (wire_attrs==NULL))
return NT_STATUS_NO_MEMORY;
@ -2293,7 +2293,7 @@ static NTSTATUS init_samr_parameters_string(TALLOC_CTX *mem_ctx,
return NT_STATUS_NO_MEMORY;
}
r->array = TALLOC_ZERO_ARRAY(mem_ctx, uint16_t, blob->length/2);
r->array = talloc_zero_array(mem_ctx, uint16_t, blob->length/2);
if (!r->array) {
return NT_STATUS_NO_MEMORY;
}
@ -4100,7 +4100,7 @@ NTSTATUS _samr_EnumDomains(struct pipes_struct *p,
return NT_STATUS_NO_MEMORY;
}
entry_array = TALLOC_ZERO_ARRAY(p->mem_ctx,
entry_array = talloc_zero_array(p->mem_ctx,
struct samr_SamEntry,
num_entries);
if (!entry_array) {
@ -5369,7 +5369,7 @@ NTSTATUS _samr_GetMembersInAlias(struct pipes_struct *p,
}
if (num_sids) {
sids = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_SidPtr, num_sids);
sids = talloc_zero_array(p->mem_ctx, struct lsa_SidPtr, num_sids);
if (sids == NULL) {
TALLOC_FREE(pdb_sids);
return NT_STATUS_NO_MEMORY;
@ -5439,7 +5439,7 @@ NTSTATUS _samr_QueryGroupMember(struct pipes_struct *p,
return status;
if (num_members) {
attr=TALLOC_ZERO_ARRAY(p->mem_ctx, uint32, num_members);
attr=talloc_zero_array(p->mem_ctx, uint32, num_members);
if (attr == NULL) {
return NT_STATUS_NO_MEMORY;
}

View File

@ -574,7 +574,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p,
num_services = lp_numservices();
unbecome_root();
allowed = TALLOC_ZERO_ARRAY(ctx, bool, num_services);
allowed = talloc_zero_array(ctx, bool, num_services);
W_ERROR_HAVE_NO_MEMORY(allowed);
/* Count the number of entries. */
@ -604,7 +604,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p,
W_ERROR_HAVE_NO_MEMORY(ctr.ctr0);
ctr.ctr0->count = alloc_entries;
ctr.ctr0->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo0, alloc_entries);
ctr.ctr0->array = talloc_zero_array(ctx, struct srvsvc_NetShareInfo0, alloc_entries);
W_ERROR_HAVE_NO_MEMORY(ctr.ctr0->array);
for (snum = 0; snum < num_services; snum++) {
@ -621,7 +621,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p,
W_ERROR_HAVE_NO_MEMORY(ctr.ctr1);
ctr.ctr1->count = alloc_entries;
ctr.ctr1->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo1, alloc_entries);
ctr.ctr1->array = talloc_zero_array(ctx, struct srvsvc_NetShareInfo1, alloc_entries);
W_ERROR_HAVE_NO_MEMORY(ctr.ctr1->array);
for (snum = 0; snum < num_services; snum++) {
@ -638,7 +638,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p,
W_ERROR_HAVE_NO_MEMORY(ctr.ctr2);
ctr.ctr2->count = alloc_entries;
ctr.ctr2->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo2, alloc_entries);
ctr.ctr2->array = talloc_zero_array(ctx, struct srvsvc_NetShareInfo2, alloc_entries);
W_ERROR_HAVE_NO_MEMORY(ctr.ctr2->array);
for (snum = 0; snum < num_services; snum++) {
@ -655,7 +655,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p,
W_ERROR_HAVE_NO_MEMORY(ctr.ctr501);
ctr.ctr501->count = alloc_entries;
ctr.ctr501->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo501, alloc_entries);
ctr.ctr501->array = talloc_zero_array(ctx, struct srvsvc_NetShareInfo501, alloc_entries);
W_ERROR_HAVE_NO_MEMORY(ctr.ctr501->array);
for (snum = 0; snum < num_services; snum++) {
@ -672,7 +672,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p,
W_ERROR_HAVE_NO_MEMORY(ctr.ctr502);
ctr.ctr502->count = alloc_entries;
ctr.ctr502->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo502, alloc_entries);
ctr.ctr502->array = talloc_zero_array(ctx, struct srvsvc_NetShareInfo502, alloc_entries);
W_ERROR_HAVE_NO_MEMORY(ctr.ctr502->array);
for (snum = 0; snum < num_services; snum++) {
@ -689,7 +689,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p,
W_ERROR_HAVE_NO_MEMORY(ctr.ctr1004);
ctr.ctr1004->count = alloc_entries;
ctr.ctr1004->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo1004, alloc_entries);
ctr.ctr1004->array = talloc_zero_array(ctx, struct srvsvc_NetShareInfo1004, alloc_entries);
W_ERROR_HAVE_NO_MEMORY(ctr.ctr1004->array);
for (snum = 0; snum < num_services; snum++) {
@ -706,7 +706,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p,
W_ERROR_HAVE_NO_MEMORY(ctr.ctr1005);
ctr.ctr1005->count = alloc_entries;
ctr.ctr1005->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo1005, alloc_entries);
ctr.ctr1005->array = talloc_zero_array(ctx, struct srvsvc_NetShareInfo1005, alloc_entries);
W_ERROR_HAVE_NO_MEMORY(ctr.ctr1005->array);
for (snum = 0; snum < num_services; snum++) {
@ -723,7 +723,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p,
W_ERROR_HAVE_NO_MEMORY(ctr.ctr1006);
ctr.ctr1006->count = alloc_entries;
ctr.ctr1006->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo1006, alloc_entries);
ctr.ctr1006->array = talloc_zero_array(ctx, struct srvsvc_NetShareInfo1006, alloc_entries);
W_ERROR_HAVE_NO_MEMORY(ctr.ctr1006->array);
for (snum = 0; snum < num_services; snum++) {
@ -740,7 +740,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p,
W_ERROR_HAVE_NO_MEMORY(ctr.ctr1007);
ctr.ctr1007->count = alloc_entries;
ctr.ctr1007->array = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetShareInfo1007, alloc_entries);
ctr.ctr1007->array = talloc_zero_array(ctx, struct srvsvc_NetShareInfo1007, alloc_entries);
W_ERROR_HAVE_NO_MEMORY(ctr.ctr1007->array);
for (snum = 0; snum < num_services; snum++) {
@ -757,7 +757,7 @@ static WERROR init_srv_share_info_ctr(struct pipes_struct *p,
W_ERROR_HAVE_NO_MEMORY(ctr.ctr1501);
ctr.ctr1501->count = alloc_entries;
ctr.ctr1501->array = TALLOC_ZERO_ARRAY(ctx, struct sec_desc_buf, alloc_entries);
ctr.ctr1501->array = talloc_zero_array(ctx, struct sec_desc_buf, alloc_entries);
W_ERROR_HAVE_NO_MEMORY(ctr.ctr1501->array);
for (snum = 0; snum < num_services; snum++) {
@ -2438,7 +2438,7 @@ WERROR _srvsvc_NetDiskEnum(struct pipes_struct *p,
*r->out.totalentries = init_server_disk_enum(&resume);
r->out.info->disks = TALLOC_ZERO_ARRAY(ctx, struct srvsvc_NetDiskInfo0,
r->out.info->disks = talloc_zero_array(ctx, struct srvsvc_NetDiskInfo0,
MAX_SERVER_DISK_ENTRIES);
W_ERROR_HAVE_NO_MEMORY(r->out.info->disks);

View File

@ -40,7 +40,7 @@ static WERROR cracknames(struct rpc_pipe_client *cli,
struct drsuapi_DsNameString *names;
struct dcerpc_binding_handle *b = cli->binding_handle;
names = TALLOC_ZERO_ARRAY(mem_ctx, struct drsuapi_DsNameString, argc);
names = talloc_zero_array(mem_ctx, struct drsuapi_DsNameString, argc);
W_ERROR_HAVE_NO_MEMORY(names);
for (i=0; i<argc; i++) {

View File

@ -728,7 +728,7 @@ static NTSTATUS cmd_samr_query_useraliases(struct rpc_pipe_client *cli,
}
if (num_sids) {
sid_array.sids = TALLOC_ZERO_ARRAY(mem_ctx, struct lsa_SidPtr, num_sids);
sid_array.sids = talloc_zero_array(mem_ctx, struct lsa_SidPtr, num_sids);
if (sid_array.sids == NULL)
return NT_STATUS_NO_MEMORY;
} else {

View File

@ -1559,7 +1559,7 @@ void DirCacheAdd(struct smb_Dir *dirp, const char *name, long offset)
}
if (dirp->name_cache == NULL) {
dirp->name_cache = TALLOC_ZERO_ARRAY(
dirp->name_cache = talloc_zero_array(
dirp, struct name_cache_entry, dirp->name_cache_size);
if (dirp->name_cache == NULL) {

View File

@ -378,7 +378,7 @@ static bool parse_msdfs_symlink(TALLOC_CTX *ctx,
DEBUG(10,("parse_msdfs_symlink: count=%d\n", count));
if (count) {
reflist = *preflist = TALLOC_ZERO_ARRAY(ctx,
reflist = *preflist = talloc_zero_array(ctx,
struct referral, count);
if(reflist == NULL) {
TALLOC_FREE(alt_path);

View File

@ -3687,7 +3687,7 @@ NTSTATUS append_parent_acl(files_struct *fsp,
num_aces += parent_sd->dacl->num_aces;
if((new_ace = TALLOC_ZERO_ARRAY(mem_ctx, struct security_ace,
if((new_ace = talloc_zero_array(mem_ctx, struct security_ace,
num_aces)) == NULL) {
return NT_STATUS_NO_MEMORY;
}

View File

@ -2957,7 +2957,7 @@ static NTSTATUS rpc_list_alias_members(struct net_context *c,
return result;
}
alias_sids = TALLOC_ZERO_ARRAY(mem_ctx, struct dom_sid, num_members);
alias_sids = talloc_zero_array(mem_ctx, struct dom_sid, num_members);
if (!alias_sids) {
d_fprintf(stderr, _("Out of memory\n"));
TALLOC_FREE(lsa_pipe);

View File

@ -211,9 +211,9 @@ static NTSTATUS registry_enumkeys(TALLOC_CTX *ctx,
return NT_STATUS_OK;
}
if ((!(names = TALLOC_ZERO_ARRAY(mem_ctx, char *, num_subkeys))) ||
(!(classes = TALLOC_ZERO_ARRAY(mem_ctx, char *, num_subkeys))) ||
(!(modtimes = TALLOC_ZERO_ARRAY(mem_ctx, NTTIME *,
if ((!(names = talloc_zero_array(mem_ctx, char *, num_subkeys))) ||
(!(classes = talloc_zero_array(mem_ctx, char *, num_subkeys))) ||
(!(modtimes = talloc_zero_array(mem_ctx, NTTIME *,
num_subkeys)))) {
status = NT_STATUS_NO_MEMORY;
goto error;

View File

@ -312,7 +312,7 @@ static struct security_descriptor* parse_acl_string(TALLOC_CTX *mem_ctx, const c
pacl = szACL;
num_ace = count_chars( pacl, ',' ) + 1;
if ( !(ace = TALLOC_ZERO_ARRAY( mem_ctx, struct security_ace, num_ace )) )
if ( !(ace = talloc_zero_array( mem_ctx, struct security_ace, num_ace )) )
return NULL;
for ( i=0; i<num_ace; i++ ) {

View File

@ -127,7 +127,7 @@ static NTSTATUS be_init(struct idmap_domain *dom)
/* Create the hash table of domain SIDs */
hashed_domains = TALLOC_ZERO_ARRAY(dom, struct sid_hash_table, 4096);
hashed_domains = talloc_zero_array(dom, struct sid_hash_table, 4096);
BAIL_ON_PTR_NT_ERROR(hashed_domains, nt_status);
/* create the hash table of domain SIDs */

View File

@ -199,7 +199,7 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain,
goto done;
}
(*pinfo) = TALLOC_ZERO_ARRAY(mem_ctx, struct wbint_userinfo, count);
(*pinfo) = talloc_zero_array(mem_ctx, struct wbint_userinfo, count);
if (!*pinfo) {
status = NT_STATUS_NO_MEMORY;
goto done;
@ -351,7 +351,7 @@ static NTSTATUS enum_dom_groups(struct winbindd_domain *domain,
goto done;
}
(*info) = TALLOC_ZERO_ARRAY(mem_ctx, struct wb_acct_info, count);
(*info) = talloc_zero_array(mem_ctx, struct wb_acct_info, count);
if (!*info) {
status = NT_STATUS_NO_MEMORY;
goto done;
@ -769,7 +769,7 @@ static NTSTATUS lookup_usergroups_memberof(struct winbindd_domain *domain,
goto done;
}
group_sids = TALLOC_ZERO_ARRAY(mem_ctx, struct dom_sid, num_strings + 1);
group_sids = talloc_zero_array(mem_ctx, struct dom_sid, num_strings + 1);
if (!group_sids) {
status = NT_STATUS_NO_MEMORY;
goto done;
@ -1085,10 +1085,10 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain *domain,
* cache. Only the rest is passed to the lsa_lookup_sids call. */
if (num_members) {
(*sid_mem) = TALLOC_ZERO_ARRAY(mem_ctx, struct dom_sid, num_members);
(*names) = TALLOC_ZERO_ARRAY(mem_ctx, char *, num_members);
(*name_types) = TALLOC_ZERO_ARRAY(mem_ctx, uint32, num_members);
(sid_mem_nocache) = TALLOC_ZERO_ARRAY(tmp_ctx, struct dom_sid, num_members);
(*sid_mem) = talloc_zero_array(mem_ctx, struct dom_sid, num_members);
(*names) = talloc_zero_array(mem_ctx, char *, num_members);
(*name_types) = talloc_zero_array(mem_ctx, uint32, num_members);
(sid_mem_nocache) = talloc_zero_array(tmp_ctx, struct dom_sid, num_members);
if ((members == NULL) || (*sid_mem == NULL) ||
(*names == NULL) || (*name_types == NULL) ||

View File

@ -2774,7 +2774,7 @@ static NTSTATUS trusted_domains(struct winbindd_domain *domain,
}
do_fetch_cache:
trusts->array = TALLOC_ZERO_ARRAY(mem_ctx, struct netr_DomainTrust, num_domains);
trusts->array = talloc_zero_array(mem_ctx, struct netr_DomainTrust, num_domains);
if (!trusts->array) {
TALLOC_FREE(dom_list);
return NT_STATUS_NO_MEMORY;

View File

@ -701,9 +701,9 @@ static NTSTATUS msrpc_lookup_groupmem(struct winbindd_domain *domain,
#define MAX_LOOKUP_RIDS 900
*names = TALLOC_ZERO_ARRAY(mem_ctx, char *, *num_names);
*name_types = TALLOC_ZERO_ARRAY(mem_ctx, uint32, *num_names);
*sid_mem = TALLOC_ZERO_ARRAY(mem_ctx, struct dom_sid, *num_names);
*names = talloc_zero_array(mem_ctx, char *, *num_names);
*name_types = talloc_zero_array(mem_ctx, uint32, *num_names);
*sid_mem = talloc_zero_array(mem_ctx, struct dom_sid, *num_names);
for (j=0;j<(*num_names);j++)
sid_compose(&(*sid_mem)[j], &domain->sid, rid_mem[j]);

View File

@ -644,7 +644,7 @@ NTSTATUS rpc_lookup_useraliases(TALLOC_CTX *mem_ctx,
num_queries, num_query_sids));
if (num_query_sids) {
sid_array.sids = TALLOC_ZERO_ARRAY(mem_ctx, struct lsa_SidPtr, num_query_sids);
sid_array.sids = talloc_zero_array(mem_ctx, struct lsa_SidPtr, num_query_sids);
if (sid_array.sids == NULL) {
return NT_STATUS_NO_MEMORY;
}
@ -839,9 +839,9 @@ NTSTATUS rpc_lookup_groupmem(TALLOC_CTX *mem_ctx,
* Step #2: Convert list of rids into list of usernames.
*/
if (num_names > 0) {
names = TALLOC_ZERO_ARRAY(mem_ctx, char *, num_names);
name_types = TALLOC_ZERO_ARRAY(mem_ctx, uint32_t, num_names);
sid_mem = TALLOC_ZERO_ARRAY(mem_ctx, struct dom_sid, num_names);
names = talloc_zero_array(mem_ctx, char *, num_names);
name_types = talloc_zero_array(mem_ctx, uint32_t, num_names);
sid_mem = talloc_zero_array(mem_ctx, struct dom_sid, num_names);
if (names == NULL || name_types == NULL || sid_mem == NULL) {
return NT_STATUS_NO_MEMORY;
}

View File

@ -80,7 +80,7 @@ struct tevent_req *winbindd_sids_to_xids_send(TALLOC_CTX *mem_ctx,
DEBUG(10, ("num_sids: %d\n", (int)state->num_sids));
state->cached = TALLOC_ZERO_ARRAY(state, struct id_map,
state->cached = talloc_zero_array(state, struct id_map,
state->num_sids);
if (tevent_req_nomem(state->cached, req)) {
return tevent_req_post(req, ev);