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

r22590: Make TALLOC_ARRAY consistent across all uses.

That should be it....
Jeremy.
(This used to be commit 603233a98b)
This commit is contained in:
Jeremy Allison 2007-04-30 02:51:26 +00:00 committed by Gerald (Jerry) Carter
parent be8b0685a5
commit 56a5d05b8b
9 changed files with 86 additions and 39 deletions

View File

@ -122,8 +122,12 @@ NTSTATUS sec_ace_del_sid(TALLOC_CTX *ctx, SEC_ACE **pp_new, SEC_ACE *old, uint32
if (!ctx || !pp_new || !old || !sid || !num) return NT_STATUS_INVALID_PARAMETER;
if (*num) {
if((pp_new[0] = TALLOC_ZERO_ARRAY(ctx, SEC_ACE, *num )) == 0)
return NT_STATUS_NO_MEMORY;
} else {
pp_new[0] = NULL;
}
for (i = 0; i < *num; i ++) {
if (sid_compare(&old[i].trustee, sid) != 0)

View File

@ -355,11 +355,15 @@ static NTSTATUS ads_dns_lookup_srv( TALLOC_CTX *ctx, const char *name, struct dn
DEBUG(4,("ads_dns_lookup_srv: %d records returned in the answer section.\n",
answer_count));
if (answer_count) {
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",
answer_count));
return NT_STATUS_NO_MEMORY;
}
} else {
dcs = NULL;
}
/* now skip the header */

View File

@ -47,12 +47,17 @@ ADS_STATUS ads_parse_gp_ext(TALLOC_CTX *mem_ctx,
gp_ext->num_exts = i;
if (gp_ext->num_exts) {
gp_ext->extensions = TALLOC_ZERO_ARRAY(mem_ctx, char *, gp_ext->num_exts);
gp_ext->extensions_guid = TALLOC_ZERO_ARRAY(mem_ctx, char *, gp_ext->num_exts);
gp_ext->snapins = TALLOC_ZERO_ARRAY(mem_ctx, char *, gp_ext->num_exts);
gp_ext->snapins_guid = TALLOC_ZERO_ARRAY(mem_ctx, char *, gp_ext->num_exts);
gp_ext->gp_extension = talloc_strdup(mem_ctx, extension_raw);
} else {
gp_ext->extensions = NULL;
gp_ext->extensions_guid = NULL;
gp_ext->snapins = NULL;
gp_ext->snapins_guid = NULL;
}
if (gp_ext->extensions == NULL || gp_ext->extensions_guid == NULL ||
gp_ext->snapins == NULL || gp_ext->snapins_guid == NULL ||
@ -60,6 +65,8 @@ ADS_STATUS ads_parse_gp_ext(TALLOC_CTX *mem_ctx,
goto parse_error;
}
gp_ext->gp_extension = talloc_strdup(mem_ctx, extension_raw);
for (i = 0; ext_list[i] != NULL; i++) {
int k;
@ -161,8 +168,13 @@ ADS_STATUS ads_parse_gplink(TALLOC_CTX *mem_ctx,
gp_link->gp_opts = options;
gp_link->num_links = i;
if (gp_link->num_links) {
gp_link->link_names = TALLOC_ZERO_ARRAY(mem_ctx, char *, gp_link->num_links);
gp_link->link_opts = TALLOC_ZERO_ARRAY(mem_ctx, uint32, gp_link->num_links);
} else {
gp_link->link_names = NULL;
gp_link->link_opts = NULL;
}
gp_link->gp_link = talloc_strdup(mem_ctx, gp_link_raw);

View File

@ -713,9 +713,13 @@ CacService *cac_MakeServiceArray( TALLOC_CTX * mem_ctx,
if ( !mem_ctx || !svc )
return NULL;
if (num_services) {
services = TALLOC_ZERO_ARRAY( mem_ctx, CacService, num_services );
if ( !services )
return NULL;
} else {
services = NULL;
}
for ( i = 0; i < num_services; i++ ) {
services[i].service_name =

View File

@ -1026,9 +1026,15 @@ static NTSTATUS idmap_backends_sids_to_unixids(struct id_map **ids)
/* split list per domain */
if (num_domains) {
dom_ids = TALLOC_ZERO_ARRAY(ctx, struct id_map **, num_domains);
IDMAP_CHECK_ALLOC(dom_ids);
counters = TALLOC_ZERO_ARRAY(ctx, int, num_domains);
IDMAP_CHECK_ALLOC(counters);
} else {
dom_ids = NULL;
counters = NULL;
}
/* partition the requests by domain */

View File

@ -907,17 +907,22 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain *domain,
the problem is that the members are in the form of distinguised names
*/
if (num_members) {
(*sid_mem) = TALLOC_ZERO_ARRAY(mem_ctx, DOM_SID, num_members);
(*name_types) = TALLOC_ZERO_ARRAY(mem_ctx, uint32, num_members);
(*names) = TALLOC_ZERO_ARRAY(mem_ctx, char *, num_members);
if ((num_members != 0) &&
((members == NULL) || (*sid_mem == NULL) ||
(*name_types == NULL) || (*names == NULL))) {
if ((members == NULL) || (*sid_mem == NULL) ||
(*name_types == NULL) || (*names == NULL)) {
DEBUG(1, ("talloc failed\n"));
status = NT_STATUS_NO_MEMORY;
goto done;
}
} else {
(*sid_mem) = NULL;
(*name_types) = NULL;
(*names) = NULL;
}
for (i=0;i<num_members;i++) {
uint32 name_type;

View File

@ -1823,8 +1823,12 @@ static int hashrec_cmp( REGF_HASH_REC *h1, REGF_HASH_REC *h2 )
memcpy( nk->subkeys.header, "lf", REC_HDR_SIZE );
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 )) )
return NULL;
} else {
nk->subkeys.hashes = NULL;
}
nk->subkey_index = 0;
/* update the max_bytes_subkey{name,classname} fields */

View File

@ -264,11 +264,15 @@ 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, struct referral, count);
if(reflist == NULL) {
DEBUG(0,("parse_msdfs_symlink: talloc failed!\n"));
return False;
}
} else {
reflist = *preflist = NULL;
}
for(i=0;i<count;i++) {
char *p;

View File

@ -670,11 +670,15 @@ static NTSTATUS fetch_group_mem_info(uint32 rid, SAM_GROUP_MEM_INFO *delta)
return NT_STATUS_NO_MEMORY;
}
if (delta->num_members) {
if ((nt_members = TALLOC_ZERO_ARRAY(t, char *, delta->num_members)) == NULL) {
DEBUG(0, ("talloc failed\n"));
talloc_free(t);
return NT_STATUS_NO_MEMORY;
}
} else {
nt_members = NULL;
}
for (i=0; i<delta->num_members; i++) {
struct samu *member = NULL;