diff options
author | Jeremy Allison <jra@samba.org> | 2007-04-27 23:18:41 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:19:44 -0500 |
commit | 12ba88574bf91bdcc4447bfc3d429b799064bfd9 (patch) | |
tree | 17f9b68292eb277da8c71871f8cad332c43d3a5a | |
parent | fdc0b87083496ae9d6d9d3d1d1a71dddaca24da2 (diff) | |
download | samba-12ba88574bf91bdcc4447bfc3d429b799064bfd9.tar.gz samba-12ba88574bf91bdcc4447bfc3d429b799064bfd9.tar.bz2 samba-12ba88574bf91bdcc4447bfc3d429b799064bfd9.zip |
r22542: Move over to using the _strict varients of the talloc
calls. No functional changes. Looks bigger than it is :-).
Jeremy.
(This used to be commit f6fa3080fee1b20df9f1968500840a88cf0ee592)
39 files changed, 143 insertions, 114 deletions
diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c index 336daa906d..e2bc8e75b5 100644 --- a/source3/auth/auth_util.c +++ b/source3/auth/auth_util.c @@ -834,9 +834,9 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username, goto done; } - group_sids = talloc_array(tmp_ctx, DOM_SID, num_group_sids); + group_sids = TALLOC_ARRAY(tmp_ctx, DOM_SID, num_group_sids); if (group_sids == NULL) { - DEBUG(1, ("talloc_array failed\n")); + DEBUG(1, ("TALLOC_ARRAY failed\n")); result = NT_STATUS_NO_MEMORY; goto done; } @@ -864,9 +864,9 @@ NTSTATUS create_token_from_username(TALLOC_CTX *mem_ctx, const char *username, uint32 dummy; num_group_sids = 1; - group_sids = talloc_array(tmp_ctx, DOM_SID, num_group_sids); + group_sids = TALLOC_ARRAY(tmp_ctx, DOM_SID, num_group_sids); if (group_sids == NULL) { - DEBUG(1, ("talloc_array failed\n")); + DEBUG(1, ("TALLOC_ARRAY failed\n")); result = NT_STATUS_NO_MEMORY; goto done; } @@ -1117,7 +1117,7 @@ static auth_serversupplied_info *copy_serverinfo(auth_serversupplied_info *src) dst->gid = src->gid; dst->n_groups = src->n_groups; if (src->n_groups != 0) { - dst->groups = (gid_t *)talloc_memdup( + dst->groups = (gid_t *)TALLOC_MEMDUP( dst, src->groups, sizeof(gid_t)*dst->n_groups); } else { dst->groups = NULL; diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h index 4a49ef3ed4..f93ed912ee 100644 --- a/source3/include/smb_macros.h +++ b/source3/include/smb_macros.h @@ -271,17 +271,19 @@ copy an IP address from one buffer to another /* The new talloc is paranoid malloc checker safe. */ -#define TALLOC(ctx, size) talloc_named_const(ctx, size, __location__) -#define TALLOC_P(ctx, type) (type *)talloc_named_const(ctx, sizeof(type), #type) -#define TALLOC_ARRAY(ctx, type, count) (type *)_talloc_array(ctx, sizeof(type), count, #type) -#define TALLOC_MEMDUP(ctx, ptr, size) _talloc_memdup(ctx, ptr, size, __location__) -#define TALLOC_ZERO(ctx, size) _talloc_zero(ctx, size, __location__) -#define TALLOC_ZERO_P(ctx, type) (type *)_talloc_zero(ctx, sizeof(type), #type) -#define TALLOC_ZERO_ARRAY(ctx, type, count) (type *)_talloc_zero_array(ctx, sizeof(type), count, #type) +#define TALLOC(ctx, size) talloc_strict(ctx, size, __location__) +#define TALLOC_P(ctx, type) (type *)talloc_strict(ctx, sizeof(type), #type) +#define TALLOC_ARRAY(ctx, type, count) (type *)_talloc_array_strict(ctx, sizeof(type), count, #type) +#define TALLOC_MEMDUP(ctx, ptr, size) _talloc_memdup_strict(ctx, ptr, size, __location__) +#define TALLOC_ZERO(ctx, size) _talloc_zero_strict(ctx, size, __location__) +#define TALLOC_ZERO_P(ctx, type) (type *)_talloc_zero_strict(ctx, sizeof(type), #type) +#define TALLOC_ZERO_ARRAY(ctx, type, count) (type *)_talloc_zero_array_strict(ctx, sizeof(type), count, #type) #define TALLOC_REALLOC(ctx, ptr, count) _talloc_realloc(ctx, ptr, count, __location__) #define TALLOC_REALLOC_ARRAY(ctx, ptr, type, count) (type *)_talloc_realloc_array(ctx, ptr, sizeof(type), count, #type) #define talloc_destroy(ctx) talloc_free(ctx) #define TALLOC_FREE(ctx) do { if ((ctx) != NULL) {talloc_free(ctx); ctx=NULL;} } while(0) +#define TALLOC_SIZE(ctx, size) talloc_strict(ctx, size) +#define TALLOC_ZERO_SIZE(ctx, size) talloc_zero_size_strict(ctx, size) /* only define PARANOID_MALLOC_CHECKER with --enable-developer and not compiling the smbmount utils */ diff --git a/source3/lib/data_blob.c b/source3/lib/data_blob.c index c7eadc1acf..e07247bc49 100644 --- a/source3/lib/data_blob.c +++ b/source3/lib/data_blob.c @@ -72,7 +72,7 @@ DATA_BLOB data_blob_talloc(TALLOC_CTX *mem_ctx, const void *p, size_t length) if (p) { ret.data = (uint8 *)TALLOC_MEMDUP(mem_ctx, p, length); if (ret.data == NULL) - smb_panic("data_blob_talloc: talloc_memdup failed.\n"); + smb_panic("data_blob_talloc: TALLOC_MEMDUP failed.\n"); } else { ret.data = (uint8 *)TALLOC(mem_ctx, length); if (ret.data == NULL) diff --git a/source3/lib/launchd.c b/source3/lib/launchd.c index 1fd5a33db0..2c3f7cac89 100644 --- a/source3/lib/launchd.c +++ b/source3/lib/launchd.c @@ -138,7 +138,7 @@ static void pull_launch_sockets(launch_data_t key, count, launch_data_dict_get_count(item))); } - linfo->socket_list = talloc_array(NULL, int, count); + linfo->socket_list = TALLOC_ARRAY(NULL, int, count); if (linfo->socket_list == NULL) { goto done; } @@ -200,7 +200,7 @@ done: linfo->num_sockets)); count = linfo->num_sockets; - linfo->socket_list = talloc_array(NULL, int, count); + linfo->socket_list = TALLOC_ARRAY(NULL, int, count); if (linfo->socket_list == NULL) { goto done; } diff --git a/source3/libaddns/dns.h b/source3/libaddns/dns.h index 6f480a5469..bbc4b68656 100644 --- a/source3/libaddns/dns.h +++ b/source3/libaddns/dns.h @@ -88,13 +88,13 @@ #include <talloc.h> -#define TALLOC(ctx, size) talloc_named_const(ctx, size, __location__) -#define TALLOC_P(ctx, type) (type *)talloc_named_const(ctx, sizeof(type), #type) -#define TALLOC_ARRAY(ctx, type, count) (type *)_talloc_array(ctx, sizeof(type), count, #type) -#define TALLOC_MEMDUP(ctx, ptr, size) _talloc_memdup(ctx, ptr, size, __location__) -#define TALLOC_ZERO(ctx, size) _talloc_zero(ctx, size, __location__) -#define TALLOC_ZERO_P(ctx, type) (type *)_talloc_zero(ctx, sizeof(type), #type) -#define TALLOC_ZERO_ARRAY(ctx, type, count) (type *)_talloc_zero_array(ctx, sizeof(type), count, #type) +#define TALLOC(ctx, size) talloc_strict(ctx, size, __location__) +#define TALLOC_P(ctx, type) (type *)talloc_strict(ctx, sizeof(type), #type) +#define TALLOC_ARRAY(ctx, type, count) (type *)_talloc_array_strict(ctx, sizeof(type), count, #type) +#define TALLOC_MEMDUP(ctx, ptr, size) _talloc_memdup_strict(ctx, ptr, size, __location__) +#define TALLOC_ZERO(ctx, size) _talloc_zero_strict(ctx, size, __location__) +#define TALLOC_ZERO_P(ctx, type) (type *)_talloc_zero_strict(ctx, sizeof(type), #type) +#define TALLOC_ZERO_ARRAY(ctx, type, count) (type *)_talloc_zero_array_strict(ctx, sizeof(type), count, #type) #define TALLOC_REALLOC(ctx, ptr, count) _talloc_realloc(ctx, ptr, count, __location__) #define TALLOC_REALLOC_ARRAY(ctx, ptr, type, count) (type *)_talloc_realloc_array(ctx, ptr, sizeof(type), count, #type) #define TALLOC_FREE(ctx) do { if ((ctx) != NULL) {talloc_free(ctx); ctx=NULL;} } while(0) diff --git a/source3/libmsrpc/cac_samr.c b/source3/libmsrpc/cac_samr.c index e85142af90..e50fb474f5 100644 --- a/source3/libmsrpc/cac_samr.c +++ b/source3/libmsrpc/cac_samr.c @@ -176,7 +176,7 @@ DOM_SID *cac_get_domain_sid( CacServerHandle * hnd, TALLOC_CTX * mem_ctx, if ( !fs.out.domain_sid ) return NULL; - sid = ( DOM_SID * ) talloc_memdup( mem_ctx, + sid = ( DOM_SID * ) TALLOC_MEMDUP( mem_ctx, &( fs.out.domain_sid->sid ), sizeof( DOM_SID ) ); @@ -718,13 +718,13 @@ int cac_SamGetGroupsForUser( CacServerHandle * hnd, TALLOC_CTX * mem_ctx, return CAC_FAILURE; - rids_out = talloc_array( mem_ctx, uint32, num_groups_out ); + rids_out = TALLOC_ARRAY( mem_ctx, uint32, num_groups_out ); if ( !rids_out ) { hnd->status = NT_STATUS_NO_MEMORY; return CAC_FAILURE; } - attr_out = talloc_array( mem_ctx, uint32, num_groups_out ); + attr_out = TALLOC_ARRAY( mem_ctx, uint32, num_groups_out ); if ( !attr_out ) { hnd->status = NT_STATUS_NO_MEMORY; return CAC_FAILURE; @@ -1153,14 +1153,14 @@ int cac_SamEnumGroups( CacServerHandle * hnd, TALLOC_CTX * mem_ctx, return CAC_FAILURE; } - names_out = talloc_array( mem_ctx, char *, num_groups_out ); + names_out = TALLOC_ARRAY( mem_ctx, char *, num_groups_out ); if ( !names_out ) { hnd->status = NT_STATUS_NO_MEMORY; TALLOC_FREE( acct_buf ); return CAC_FAILURE; } - desc_out = talloc_array( mem_ctx, char *, num_groups_out ); + desc_out = TALLOC_ARRAY( mem_ctx, char *, num_groups_out ); if ( !desc_out ) { hnd->status = NT_STATUS_NO_MEMORY; TALLOC_FREE( acct_buf ); @@ -1168,7 +1168,7 @@ int cac_SamEnumGroups( CacServerHandle * hnd, TALLOC_CTX * mem_ctx, return CAC_FAILURE; } - rids_out = talloc_array( mem_ctx, uint32, num_groups_out ); + rids_out = TALLOC_ARRAY( mem_ctx, uint32, num_groups_out ); if ( !rids_out ) { hnd->status = NT_STATUS_NO_MEMORY; TALLOC_FREE( acct_buf ); @@ -1256,14 +1256,14 @@ int cac_SamEnumAliases( CacServerHandle * hnd, TALLOC_CTX * mem_ctx, NT_STATUS_V( STATUS_MORE_ENTRIES ) ) return CAC_FAILURE; - names_out = talloc_array( mem_ctx, char *, num_als_out ); + names_out = TALLOC_ARRAY( mem_ctx, char *, num_als_out ); if ( !names_out ) { hnd->status = NT_STATUS_NO_MEMORY; TALLOC_FREE( acct_buf ); return CAC_FAILURE; } - desc_out = talloc_array( mem_ctx, char *, num_als_out ); + desc_out = TALLOC_ARRAY( mem_ctx, char *, num_als_out ); if ( !desc_out ) { hnd->status = NT_STATUS_NO_MEMORY; TALLOC_FREE( acct_buf ); @@ -1271,7 +1271,7 @@ int cac_SamEnumAliases( CacServerHandle * hnd, TALLOC_CTX * mem_ctx, return CAC_FAILURE; } - rids_out = talloc_array( mem_ctx, uint32, num_als_out ); + rids_out = TALLOC_ARRAY( mem_ctx, uint32, num_als_out ); if ( !rids_out ) { hnd->status = NT_STATUS_NO_MEMORY; TALLOC_FREE( acct_buf ); diff --git a/source3/libmsrpc/cac_winreg.c b/source3/libmsrpc/cac_winreg.c index 74156be63f..ee9d16aa64 100644 --- a/source3/libmsrpc/cac_winreg.c +++ b/source3/libmsrpc/cac_winreg.c @@ -775,14 +775,14 @@ int cac_RegEnumValues( CacServerHandle * hnd, TALLOC_CTX * mem_ctx, } /*we need to assume that the max number of values will be enumerated */ - types_out = talloc_array( mem_ctx, uint32, op->in.max_values ); + types_out = TALLOC_ARRAY( mem_ctx, uint32, op->in.max_values ); if ( !types_out ) { hnd->status = NT_STATUS_NO_MEMORY; return CAC_FAILURE; } - values_out = talloc_array( mem_ctx, REG_VALUE_DATA *, + values_out = TALLOC_ARRAY( mem_ctx, REG_VALUE_DATA *, op->in.max_values ); if ( !values_out ) { @@ -791,7 +791,7 @@ int cac_RegEnumValues( CacServerHandle * hnd, TALLOC_CTX * mem_ctx, return CAC_FAILURE; } - val_names_out = talloc_array( mem_ctx, char *, op->in.max_values ); + val_names_out = TALLOC_ARRAY( mem_ctx, char *, op->in.max_values ); if ( !val_names_out ) { TALLOC_FREE( types_out ); diff --git a/source3/libmsrpc/libmsrpc_internal.c b/source3/libmsrpc/libmsrpc_internal.c index b9eb5a40e9..a86cde178d 100644 --- a/source3/libmsrpc/libmsrpc_internal.c +++ b/source3/libmsrpc/libmsrpc_internal.c @@ -200,7 +200,7 @@ char *cac_unistr_to_str( TALLOC_CTX * mem_ctx, uint16 * src, int num_bytes ) /*need room for a '\0' */ str_len++; - buf = talloc_array( mem_ctx, char, str_len ); + buf = TALLOC_ARRAY( mem_ctx, char, str_len ); if ( !buf ) { return NULL; @@ -265,7 +265,7 @@ REG_VALUE_DATA *cac_MakeRegValueData( TALLOC_CTX * mem_ctx, uint32 data_type, data->reg_binary.data_length = size; data->reg_binary.data = - ( uint8 * ) talloc_memdup( mem_ctx, buf.buffer, + ( uint8 * ) TALLOC_MEMDUP( mem_ctx, buf.buffer, size ); if ( !data->reg_binary.data ) { TALLOC_FREE( data ); @@ -296,7 +296,7 @@ REG_VALUE_DATA *cac_MakeRegValueData( TALLOC_CTX * mem_ctx, uint32 data_type, break; } - strings = talloc_array( mem_ctx, char *, num_strings ); + strings = TALLOC_ARRAY( mem_ctx, char *, num_strings ); if ( !strings ) { errno = ENOMEM; @@ -424,7 +424,7 @@ char *talloc_unistr2_to_ascii( TALLOC_CTX * mem_ctx, UNISTR2 str ) if ( !mem_ctx ) return NULL; - buf = talloc_array( mem_ctx, char, ( str.uni_str_len + 1 ) ); + buf = TALLOC_ARRAY( mem_ctx, char, ( str.uni_str_len + 1 ) ); if ( !buf ) return NULL; @@ -514,7 +514,7 @@ CacUserInfo *cac_MakeUserInfo( TALLOC_CTX * mem_ctx, SAM_USERINFO_CTR * ctr ) memcpy( info->lm_password, id21->lm_pwd, 8 ); info->logon_hours = - ( LOGON_HRS * ) talloc_memdup( mem_ctx, &( id21->logon_hrs ), + ( LOGON_HRS * ) TALLOC_MEMDUP( mem_ctx, &( id21->logon_hrs ), sizeof( LOGON_HRS ) ); if ( !info->logon_hours ) return NULL; diff --git a/source3/libsmb/cliquota.c b/source3/libsmb/cliquota.c index 5627d28bb5..2a47ae2463 100644 --- a/source3/libsmb/cliquota.c +++ b/source3/libsmb/cliquota.c @@ -322,13 +322,13 @@ BOOL cli_list_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_LIST } if ((tmp_list_ent=TALLOC_ZERO_P(mem_ctx,SMB_NTQUOTA_LIST))==NULL) { - DEBUG(0,("talloc_zero() failed\n")); + DEBUG(0,("TALLOC_ZERO() failed\n")); talloc_destroy(mem_ctx); return (-1); } if ((tmp_list_ent->quotas=TALLOC_ZERO_P(mem_ctx,SMB_NTQUOTA_STRUCT))==NULL) { - DEBUG(0,("talloc_zero() failed\n")); + DEBUG(0,("TALLOC_ZERO() failed\n")); talloc_destroy(mem_ctx); return (-1); } @@ -382,13 +382,13 @@ BOOL cli_list_user_quota(struct cli_state *cli, int quota_fnum, SMB_NTQUOTA_LIST } if ((tmp_list_ent=TALLOC_ZERO_P(mem_ctx,SMB_NTQUOTA_LIST))==NULL) { - DEBUG(0,("talloc_zero() failed\n")); + DEBUG(0,("TALLOC_ZERO() failed\n")); talloc_destroy(mem_ctx); goto cleanup; } if ((tmp_list_ent->quotas=TALLOC_ZERO_P(mem_ctx,SMB_NTQUOTA_STRUCT))==NULL) { - DEBUG(0,("talloc_zero() failed\n")); + DEBUG(0,("TALLOC_ZERO() failed\n")); talloc_destroy(mem_ctx); goto cleanup; } diff --git a/source3/locking/locking.c b/source3/locking/locking.c index dc1d607155..c548d6eecb 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -521,7 +521,7 @@ static BOOL parse_share_modes(TDB_DATA dbuf, struct share_mode_lock *lck) } lck->share_modes = (struct share_mode_entry *) - talloc_memdup(lck, dbuf.dptr+sizeof(*data), + TALLOC_MEMDUP(lck, dbuf.dptr+sizeof(*data), lck->num_share_modes * sizeof(struct share_mode_entry)); diff --git a/source3/modules/nfs4_acls.c b/source3/modules/nfs4_acls.c index dd45240857..b6bcc8cd47 100644 --- a/source3/modules/nfs4_acls.c +++ b/source3/modules/nfs4_acls.c @@ -84,10 +84,10 @@ static SMB_ACE4_INT_T *get_validated_aceint(SMB4ACE_T *ace) SMB4ACL_T *smb_create_smb4acl(void) { TALLOC_CTX *mem_ctx = main_loop_talloc_get(); - SMB_ACL4_INT_T *acl = (SMB_ACL4_INT_T *)talloc_size(mem_ctx, sizeof(SMB_ACL4_INT_T)); + SMB_ACL4_INT_T *acl = (SMB_ACL4_INT_T *)TALLOC_SIZE(mem_ctx, sizeof(SMB_ACL4_INT_T)); if (acl==NULL) { - DEBUG(0, ("talloc_size failed\n")); + DEBUG(0, ("TALLOC_SIZE failed\n")); errno = ENOMEM; return NULL; } @@ -103,10 +103,10 @@ SMB4ACE_T *smb_add_ace4(SMB4ACL_T *acl, SMB_ACE4PROP_T *prop) TALLOC_CTX *mem_ctx = main_loop_talloc_get(); SMB_ACE4_INT_T *ace; - ace = (SMB_ACE4_INT_T *)talloc_size(mem_ctx, sizeof(SMB_ACE4_INT_T)); + ace = (SMB_ACE4_INT_T *)TALLOC_SIZE(mem_ctx, sizeof(SMB_ACE4_INT_T)); if (ace==NULL) { - DEBUG(0, ("talloc_size failed\n")); + DEBUG(0, ("TALLOC_SIZE failed\n")); errno = ENOMEM; return NULL; } @@ -206,7 +206,7 @@ static BOOL smbacl4_nfs42win(SMB4ACL_T *acl, /* in */ if (aclint==NULL) return False; - nt_ace_list = (SEC_ACE *)talloc_size(mem_ctx, aclint->naces * sizeof(SEC_ACE)); + nt_ace_list = (SEC_ACE *)TALLOC_SIZE(mem_ctx, aclint->naces * sizeof(SEC_ACE)); if (nt_ace_list==NULL) { DEBUG(10, ("talloc error")); diff --git a/source3/modules/vfs_aixacl2.c b/source3/modules/vfs_aixacl2.c index 62a517a6e0..f1e116ec19 100644 --- a/source3/modules/vfs_aixacl2.c +++ b/source3/modules/vfs_aixacl2.c @@ -68,7 +68,7 @@ static AIXJFS2_ACL_T *aixjfs2_getacl_alloc(const char *fname, acl_type_t *type) TALLOC_CTX *mem_ctx; mem_ctx = main_loop_talloc_get(); - acl = (AIXJFS2_ACL_T *)talloc_size(mem_ctx, len); + acl = (AIXJFS2_ACL_T *)TALLOC_SIZE(mem_ctx, len); if (acl == NULL) { errno = ENOMEM; return NULL; @@ -83,7 +83,7 @@ static AIXJFS2_ACL_T *aixjfs2_getacl_alloc(const char *fname, acl_type_t *type) len = aixacl2_getlen(acl, type) + sizeof(AIXJFS2_ACL_T); DEBUG(10,("aixjfs2_getacl_alloc - acl_len:%d\n",len)); - acl = (AIXJFS2_ACL_T *)talloc_size(mem_ctx, len); + acl = (AIXJFS2_ACL_T *)TALLOC_SIZE(mem_ctx, len); if (acl == NULL) { errno = ENOMEM; return NULL; @@ -312,9 +312,9 @@ static BOOL aixjfs2_process_smbacl(files_struct *fsp, SMB4ACL_T *smbacl) naces = smb_get_naces(smbacl); aclLen = ACL_V4_SIZ + naces * entryLen; - jfs2acl = (nfs4_acl_int_t *)talloc_size(mem_ctx, aclLen); + jfs2acl = (nfs4_acl_int_t *)TALLOC_SIZE(mem_ctx, aclLen); if (jfs2acl==NULL) { - DEBUG(0, ("talloc_size failed\n")); + DEBUG(0, ("TALLOC_SIZE failed\n")); errno = ENOMEM; return False; } diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c index 6841300d5b..932b5000c8 100644 --- a/source3/modules/vfs_gpfs.c +++ b/source3/modules/vfs_gpfs.c @@ -104,7 +104,7 @@ static struct gpfs_acl *gpfs_getacl_alloc(const char *fname, gpfs_aclType_t type int ret; TALLOC_CTX *mem_ctx = main_loop_talloc_get(); - acl = (struct gpfs_acl *)talloc_size(mem_ctx, len); + acl = (struct gpfs_acl *)TALLOC_SIZE(mem_ctx, len); if (acl == NULL) { errno = ENOMEM; return NULL; @@ -117,7 +117,7 @@ static struct gpfs_acl *gpfs_getacl_alloc(const char *fname, gpfs_aclType_t type ret = smbd_gpfs_getacl((char *)fname, GPFS_GETACL_STRUCT | GPFS_ACL_SAMBA, acl); if ((ret != 0) && (errno == ENOSPC)) { - struct gpfs_acl *new_acl = (struct gpfs_acl *)talloc_size( + struct gpfs_acl *new_acl = (struct gpfs_acl *)TALLOC_SIZE( mem_ctx, acl->acl_len + sizeof(struct gpfs_acl)); if (new_acl == NULL) { errno = ENOMEM; @@ -260,7 +260,7 @@ static BOOL gpfsacl_process_smbacl(files_struct *fsp, SMB4ACL_T *smbacl) gacl_len = sizeof(struct gpfs_acl) + (smb_get_naces(smbacl)-1)*sizeof(gpfs_ace_v4_t); - gacl = talloc_size(mem_ctx, gacl_len); + gacl = TALLOC_SIZE(mem_ctx, gacl_len); if (gacl == NULL) { DEBUG(0, ("talloc failed\n")); errno = ENOMEM; diff --git a/source3/nsswitch/idmap.c b/source3/nsswitch/idmap.c index 7589ee66ab..26fcc692e9 100644 --- a/source3/nsswitch/idmap.c +++ b/source3/nsswitch/idmap.c @@ -360,7 +360,7 @@ NTSTATUS idmap_init(void) } /* init domain */ - dom = talloc_zero(idmap_ctx, struct idmap_domain); + dom = TALLOC_ZERO_P(idmap_ctx, struct idmap_domain); IDMAP_CHECK_ALLOC(dom); dom->name = talloc_strdup(dom, dom_list[i]); @@ -464,7 +464,7 @@ NTSTATUS idmap_init(void) ( ! pri_dom_is_in_list) && lp_winbind_trusted_domains_only()) { - dom = talloc_zero(idmap_ctx, struct idmap_domain); + dom = TALLOC_ZERO_P(idmap_ctx, struct idmap_domain); IDMAP_CHECK_ALLOC(dom); dom->name = talloc_strdup(dom, lp_workgroup()); @@ -515,7 +515,7 @@ NTSTATUS idmap_init(void) } /**** automatically add idmap_passdb backend ****/ - dom = talloc_zero(idmap_ctx, struct idmap_domain); + dom = TALLOC_ZERO_P(idmap_ctx, struct idmap_domain); IDMAP_CHECK_ALLOC(dom); dom->name = talloc_strdup(dom, get_global_sam_name()); @@ -607,7 +607,7 @@ NTSTATUS idmap_init(void) if ( alloc_backend ) { - idmap_alloc_ctx = talloc_zero(idmap_ctx, struct idmap_alloc_context); + idmap_alloc_ctx = TALLOC_ZERO_P(idmap_ctx, struct idmap_alloc_context); IDMAP_CHECK_ALLOC(idmap_alloc_ctx); idmap_alloc_ctx->methods = get_alloc_methods(alloc_backends, alloc_backend); @@ -1026,9 +1026,9 @@ static NTSTATUS idmap_backends_sids_to_unixids(struct id_map **ids) /* split list per domain */ - dom_ids = talloc_zero_array(ctx, struct id_map **, 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); + counters = TALLOC_ZERO_ARRAY(ctx, int, num_domains); /* partition the requests by domain */ @@ -1143,7 +1143,7 @@ NTSTATUS idmap_unixids_to_sids(struct id_map **ids) if ( ! bids) { /* alloc space for ids to be resolved by backends (realloc ten by ten) */ - bids = talloc_array(ctx, struct id_map *, 10); + bids = TALLOC_ARRAY(ctx, struct id_map *, 10); if ( ! bids) { DEBUG(1, ("Out of memory!\n")); talloc_free(ctx); @@ -1248,7 +1248,7 @@ NTSTATUS idmap_sids_to_unixids(struct id_map **ids) if ( ! bids) { /* alloc space for ids to be resolved by backends (realloc ten by ten) */ - bids = talloc_array(ctx, struct id_map *, 10); + bids = TALLOC_ARRAY(ctx, struct id_map *, 10); if ( ! bids) { DEBUG(1, ("Out of memory!\n")); talloc_free(ctx); diff --git a/source3/nsswitch/idmap_ad.c b/source3/nsswitch/idmap_ad.c index e15e4b90fb..d3fd9e1c8a 100644 --- a/source3/nsswitch/idmap_ad.c +++ b/source3/nsswitch/idmap_ad.c @@ -167,7 +167,7 @@ static NTSTATUS idmap_ad_initialize(struct idmap_domain *dom) const char *range = NULL; const char *schema_mode = NULL; - if ( (ctx = talloc_zero(dom, struct idmap_ad_context)) == NULL ) { + if ( (ctx = TALLOC_ZERO(dom, struct idmap_ad_context)) == NULL ) { DEBUG(0, ("Out of memory!\n")); return NT_STATUS_NO_MEMORY; } diff --git a/source3/nsswitch/idmap_ldap.c b/source3/nsswitch/idmap_ldap.c index 7575416af5..2fb9a17d3f 100644 --- a/source3/nsswitch/idmap_ldap.c +++ b/source3/nsswitch/idmap_ldap.c @@ -216,7 +216,7 @@ static NTSTATUS idmap_ldap_alloc_init(const char *params) return NT_STATUS_FILE_IS_OFFLINE; } - idmap_alloc_ldap = talloc_zero(NULL, struct idmap_ldap_alloc_context); + idmap_alloc_ldap = TALLOC_ZERO_P(NULL, struct idmap_ldap_alloc_context); CHECK_ALLOC_DONE( idmap_alloc_ldap ); /* load ranges */ @@ -736,7 +736,7 @@ static NTSTATUS idmap_ldap_db_init(struct idmap_domain *dom) return NT_STATUS_FILE_IS_OFFLINE; } - ctx = talloc_zero(dom, struct idmap_ldap_context); + ctx = TALLOC_ZERO_P(dom, struct idmap_ldap_context); if ( ! ctx) { DEBUG(0, ("Out of memory!\n")); return NT_STATUS_NO_MEMORY; diff --git a/source3/nsswitch/idmap_rid.c b/source3/nsswitch/idmap_rid.c index 8e016879b8..1daf511dda 100644 --- a/source3/nsswitch/idmap_rid.c +++ b/source3/nsswitch/idmap_rid.c @@ -44,7 +44,7 @@ static NTSTATUS idmap_rid_initialize(struct idmap_domain *dom) char *config_option = NULL; const char *range; - if ( (ctx = talloc_zero(dom, struct idmap_rid_context)) == NULL ) { + if ( (ctx = TALLOC_ZERO(dom, struct idmap_rid_context)) == NULL ) { DEBUG(0, ("Out of memory!\n")); return NT_STATUS_NO_MEMORY; } diff --git a/source3/nsswitch/idmap_tdb.c b/source3/nsswitch/idmap_tdb.c index 4eb47c42b8..2961229e49 100644 --- a/source3/nsswitch/idmap_tdb.c +++ b/source3/nsswitch/idmap_tdb.c @@ -1176,7 +1176,7 @@ static NTSTATUS idmap_tdb_dump_data(struct idmap_domain *dom, struct id_map **ma ctx = talloc_get_type(dom->private_data, struct idmap_tdb_context); - data = talloc_zero(ctx, struct dump_data); + data = TALLOC_ZERO_P(ctx, struct dump_data); if ( ! data) { DEBUG(0, ("Out of memory!\n")); return NT_STATUS_NO_MEMORY; diff --git a/source3/nsswitch/winbindd_async.c b/source3/nsswitch/winbindd_async.c index aa48f513e9..a8a92c3cae 100644 --- a/source3/nsswitch/winbindd_async.c +++ b/source3/nsswitch/winbindd_async.c @@ -276,13 +276,13 @@ enum winbindd_result winbindd_dual_sids2xids(struct winbindd_domain *domain, sids = (DOM_SID *)state->request.extra_data.data; num = state->request.extra_len / sizeof(DOM_SID); - ids = talloc_zero_array(state->mem_ctx, struct id_map *, num + 1); + ids = TALLOC_ZERO_ARRAY(state->mem_ctx, struct id_map *, num + 1); if ( ! ids) { DEBUG(0, ("Out of memory!\n")); return WINBINDD_ERROR; } for (i = 0; i < num; i++) { - ids[i] = talloc(ids, struct id_map); + ids[i] = TALLOC_P(ids, struct id_map); if ( ! ids[i]) { DEBUG(0, ("Out of memory!\n")); talloc_free(ids); diff --git a/source3/printing/notify.c b/source3/printing/notify.c index 2db8768395..e2aed5ce25 100644 --- a/source3/printing/notify.c +++ b/source3/printing/notify.c @@ -222,7 +222,7 @@ static BOOL copy_notify2_msg( SPOOLSS_NOTIFY_MSG *to, SPOOLSS_NOTIFY_MSG *from ) if ( from->len ) { to->notify.data = (char *)TALLOC_MEMDUP(send_ctx, from->notify.data, from->len ); if ( !to->notify.data ) { - DEBUG(0,("copy_notify2_msg: talloc_memdup() of size [%d] failed!\n", from->len )); + DEBUG(0,("copy_notify2_msg: TALLOC_MEMDUP() of size [%d] failed!\n", from->len )); return False; } } diff --git a/source3/python/py_ntsec.c b/source3/python/py_ntsec.c index e59a33f97b..f82433a69f 100644 --- a/source3/python/py_ntsec.c +++ b/source3/python/py_ntsec.c @@ -157,7 +157,7 @@ BOOL py_to_ACL(SEC_ACL *acl, PyObject *dict, TALLOC_CTX *mem_ctx) acl->num_aces = PyList_Size(obj); - acl->aces = talloc_array(mem_ctx, struct security_ace, acl->num_aces); + acl->aces = TALLOC_ARRAY(mem_ctx, struct security_ace, acl->num_aces); acl->size = SEC_ACL_HEADER_SIZE; for (i = 0; i < acl->num_aces; i++) { diff --git a/source3/rpc_parse/parse_buffer.c b/source3/rpc_parse/parse_buffer.c index 5643189afe..b66eb9910a 100644 --- a/source3/rpc_parse/parse_buffer.c +++ b/source3/rpc_parse/parse_buffer.c @@ -401,6 +401,9 @@ BOOL smb_io_relarraystr(const char *desc, RPC_BUFFER *buffer, int depth, uint16 { chaine2[l_chaine2] = '\0'; *string=(uint16 *)TALLOC_MEMDUP(prs_get_mem_context(ps),chaine2,realloc_size); + if (!*string) { + return False; + } SAFE_FREE(chaine2); } diff --git a/source3/rpc_parse/parse_eventlog.c b/source3/rpc_parse/parse_eventlog.c index addf433feb..436f35aff6 100644 --- a/source3/rpc_parse/parse_eventlog.c +++ b/source3/rpc_parse/parse_eventlog.c @@ -354,7 +354,9 @@ BOOL eventlog_io_r_read_eventlog(const char *desc, /* Now pad with whitespace until the end of the response buffer */ if (q_u->max_read_size - r_u->num_bytes_in_resp) { - r_u->end_of_entries_padding = SMB_CALLOC_ARRAY(uint8, q_u->max_read_size - r_u->num_bytes_in_resp); + if (!r_u->end_of_entries_padding) { + return False; + } if(!(prs_uint8s(False, "end of entries padding", ps, depth, r_u->end_of_entries_padding, diff --git a/source3/rpc_parse/parse_misc.c b/source3/rpc_parse/parse_misc.c index efc5274f45..a42915aa08 100644 --- a/source3/rpc_parse/parse_misc.c +++ b/source3/rpc_parse/parse_misc.c @@ -221,7 +221,7 @@ BOOL smb_io_dom_sid2_p(const char *desc, prs_struct *ps, int depth, DOM_SID2 **s if (UNMARSHALLING(ps)) { if ( !(*sid2 = PRS_ALLOC_MEM(ps, DOM_SID2, 1)) ) - return False; + return False; } return True; diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index 3eb31ad55f..b3331c8369 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -2995,7 +2995,16 @@ static BOOL net_io_sam_privs_info(const char *desc, SAM_DELTA_PRIVS *info, if(!prs_uint32("attribute_count", ps, depth, &info->attribute_count)) return False; - info->attributes = TALLOC_ARRAY(ps->mem_ctx, uint32, info->attribute_count); + if (UNMARSHALLING(ps)) { + if (info->attribute_count) { + info->attributes = TALLOC_ARRAY(ps->mem_ctx, uint32, info->attribute_count); + if (!info->attributes) { + return False; + } + } else { + info->attributes = NULL; + } + } for (i=0; i<info->attribute_count; i++) if(!prs_uint32("attributes", ps, depth, &info->attributes[i])) @@ -3004,8 +3013,21 @@ static BOOL net_io_sam_privs_info(const char *desc, SAM_DELTA_PRIVS *info, if(!prs_uint32("privlist_count", ps, depth, &info->privlist_count)) return False; - info->hdr_privslist = TALLOC_ARRAY(ps->mem_ctx, UNIHDR, info->privlist_count); - info->uni_privslist = TALLOC_ARRAY(ps->mem_ctx, UNISTR2, info->privlist_count); + if (UNMARSHALLING(ps)) { + if (info->privlist_count) { + info->hdr_privslist = TALLOC_ARRAY(ps->mem_ctx, UNIHDR, info->privlist_count); + info->uni_privslist = TALLOC_ARRAY(ps->mem_ctx, UNISTR2, info->privlist_count); + if (!info->hdr_privslist) { + return False; + } + if (!info->uni_privslist) { + return False; + } + } else { + info->hdr_privslist = NULL; + info->uni_privslist = NULL; + } + } for (i=0; i<info->privlist_count; i++) if(!smb_io_unihdr("hdr_privslist", &info->hdr_privslist[i], ps, depth)) diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 172195f823..bf79c44395 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -156,9 +156,9 @@ char *prs_alloc_mem(prs_struct *ps, size_t size, unsigned int count) { char *ret = NULL; - if (size) { + if (size && count) { /* We can't call the type-safe version here. */ - ret = (char *)_talloc_zero_array(ps->mem_ctx, size, count, + ret = (char *)_talloc_zero_array_strict(ps->mem_ctx, size, count, "parse_prs"); } return ret; @@ -1825,7 +1825,7 @@ return the contents of a prs_struct in a DATA_BLOB BOOL prs_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx) { blob->length = prs_data_size(prs); - blob->data = (uint8 *)talloc_zero_size(mem_ctx, blob->length); + blob->data = (uint8 *)TALLOC_ZERO_SIZE(mem_ctx, blob->length); /* set the pointer at the end of the buffer */ prs_set_offset( prs, prs_data_size(prs) ); diff --git a/source3/rpc_server/srv_echo_nt.c b/source3/rpc_server/srv_echo_nt.c index eb095f6bfe..58ab51e2b0 100644 --- a/source3/rpc_server/srv_echo_nt.c +++ b/source3/rpc_server/srv_echo_nt.c @@ -120,7 +120,7 @@ void _echo_TestEnum(pipes_struct *p, struct echo_TestEnum *r) void _echo_TestSurrounding(pipes_struct *p, struct echo_TestSurrounding *r) { r->out.data->x *= 2; - r->out.data->surrounding = talloc_zero_array(p->mem_ctx, uint16_t, r->in.data->x); + r->out.data->surrounding = TALLOC_ZERO_ARRAY(p->mem_ctx, uint16_t, r->in.data->x); } uint16 _echo_TestDoublePointer(pipes_struct *p, struct echo_TestDoublePointer *r) diff --git a/source3/rpc_server/srv_samr_nt.c b/source3/rpc_server/srv_samr_nt.c index a128757ad0..80b1b93a50 100644 --- a/source3/rpc_server/srv_samr_nt.c +++ b/source3/rpc_server/srv_samr_nt.c @@ -854,7 +854,7 @@ static NTSTATUS make_user_sam_entry_list(TALLOC_CTX *ctx, SAM_ENTRY **sam_pp, uni_name = TALLOC_ZERO_ARRAY(ctx, UNISTR2, num_entries); if (sam == NULL || uni_name == NULL) { - DEBUG(0, ("make_user_sam_entry_list: talloc_zero failed!\n")); + DEBUG(0, ("make_user_sam_entry_list: TALLOC_ZERO failed!\n")); return NT_STATUS_NO_MEMORY; } diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 3e1c1a2408..beb3b5aef0 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -9504,7 +9504,7 @@ WERROR _spoolss_enumprinterdataex(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATAEX *q_ if ( data_len ) { if ( !(enum_values[i].data = (uint8 *)TALLOC_MEMDUP(p->mem_ctx, regval_data_p(val), data_len)) ) { - DEBUG(0,("talloc_memdup failed to allocate memory [data_len=%d] for data!\n", + DEBUG(0,("TALLOC_MEMDUP failed to allocate memory [data_len=%d] for data!\n", data_len )); result = WERR_NOMEM; goto done; diff --git a/source3/rpc_server/srv_srvsvc_nt.c b/source3/rpc_server/srv_srvsvc_nt.c index 615f5e1b07..8f68bf36a1 100644 --- a/source3/rpc_server/srv_srvsvc_nt.c +++ b/source3/rpc_server/srv_srvsvc_nt.c @@ -544,61 +544,61 @@ static WERROR init_srv_share_info_ctr(pipes_struct *p, switch (info_level) { case 0: - if (!(ctr->ctr0 = talloc_zero( + if (!(ctr->ctr0 = TALLOC_ZERO_P( p->mem_ctx, struct srvsvc_NetShareCtr0))) { goto done; } break; case 1: - if (!(ctr->ctr1 = talloc_zero( + if (!(ctr->ctr1 = TALLOC_ZERO_P( p->mem_ctx, struct srvsvc_NetShareCtr1))) { goto done; } break; case 2: - if (!(ctr->ctr2 = talloc_zero( + if (!(ctr->ctr2 = TALLOC_ZERO_P( p->mem_ctx, struct srvsvc_NetShareCtr2))) { goto done; } break; case 501: - if (!(ctr->ctr501 = talloc_zero( + if (!(ctr->ctr501 = TALLOC_ZERO_P( p->mem_ctx, struct srvsvc_NetShareCtr501))) { goto done; } break; case 502: - if (!(ctr->ctr502 = talloc_zero( + if (!(ctr->ctr502 = TALLOC_ZERO_P( p->mem_ctx, struct srvsvc_NetShareCtr502))) { goto done; } break; case 1004: - if (!(ctr->ctr1004 = talloc_zero( + if (!(ctr->ctr1004 = TALLOC_ZERO_P( p->mem_ctx, struct srvsvc_NetShareCtr1004))) { goto done; } break; case 1005: - if (!(ctr->ctr1005 = talloc_zero( + if (!(ctr->ctr1005 = TALLOC_ZERO_P( p->mem_ctx, struct srvsvc_NetShareCtr1005))) { goto done; } break; case 1006: - if (!(ctr->ctr1006 = talloc_zero( + if (!(ctr->ctr1006 = TALLOC_ZERO_P( p->mem_ctx, struct srvsvc_NetShareCtr1006))) { goto done; } break; case 1007: - if (!(ctr->ctr1007 = talloc_zero( + if (!(ctr->ctr1007 = TALLOC_ZERO_P( p->mem_ctx, struct srvsvc_NetShareCtr1007))) { goto done; } break; case 1501: - if (!(ctr->ctr1501 = talloc_zero( + if (!(ctr->ctr1501 = TALLOC_ZERO_P( p->mem_ctx, struct srvsvc_NetShareCtr1501))) { goto done; } @@ -781,7 +781,7 @@ static void init_srv_sess_info_0(pipes_struct *p, struct srvsvc_NetSessCtr0 *ss0 DEBUG(5,("init_srv_sess_0_ss0\n")); - ss0->array = talloc_array(p->mem_ctx, struct srvsvc_NetSessInfo0, *stot); + ss0->array = TALLOC_ARRAY(p->mem_ctx, struct srvsvc_NetSessInfo0, *stot); if (snum) { for (; (*snum) < (*stot); (*snum)++) { @@ -861,7 +861,7 @@ static void init_srv_sess_info_1(pipes_struct *p, struct srvsvc_NetSessCtr1 *ss1 (*stot) = list_sessions(&session_list); - ss1->array = talloc_array(p->mem_ctx, struct srvsvc_NetSessInfo1, *stot); + ss1->array = TALLOC_ARRAY(p->mem_ctx, struct srvsvc_NetSessInfo1, *stot); for (; (*snum) < (*stot); (*snum)++) { uint32 num_files; @@ -954,7 +954,7 @@ static void init_srv_conn_info_0(pipes_struct *p, struct srvsvc_NetConnCtr0 *ss0 DEBUG(5,("init_srv_conn_0_ss0\n")); if (snum) { - ss0->array = talloc_array(p->mem_ctx, struct srvsvc_NetConnInfo0, *stot); + ss0->array = TALLOC_ARRAY(p->mem_ctx, struct srvsvc_NetConnInfo0, *stot); for (; (*snum) < (*stot); (*snum)++) { ss0->array[num_entries].conn_id = (*stot); @@ -996,7 +996,7 @@ static void init_srv_conn_info_1(pipes_struct *p, struct srvsvc_NetConnCtr1 *ss1 DEBUG(5,("init_srv_conn_1_ss1\n")); if (snum) { - ss1->array = talloc_array(p->mem_ctx, struct srvsvc_NetConnInfo1, *stot); + ss1->array = TALLOC_ARRAY(p->mem_ctx, struct srvsvc_NetConnInfo1, *stot); for (; (*snum) < (*stot); (*snum)++) { ss1->array[num_entries].conn_id = (*stot); ss1->array[num_entries].conn_type = 0x3; @@ -1067,7 +1067,7 @@ static WERROR net_file_enum_3(pipes_struct *p, union srvsvc_NetFileCtr *ctr, uin (b) active pipes (c) open directories and files */ - ctr->ctr3 = talloc_zero(p->mem_ctx, struct srvsvc_NetFileCtr3); + ctr->ctr3 = TALLOC_ZERO_P(p->mem_ctx, struct srvsvc_NetFileCtr3); status = net_enum_files( ctx, &ctr->ctr3->array, num_entries, resume_hnd ); if ( !W_ERROR_IS_OK(status)) @@ -1121,7 +1121,7 @@ WERROR _srvsvc_NetSrvGetInfo(pipes_struct *p, struct srvsvc_NetSrvGetInfo *r) here, as most of it is made up. */ case 102: - r->out.info->info102 = talloc_zero(p->mem_ctx, struct srvsvc_NetSrvInfo102); + r->out.info->info102 = TALLOC_ZERO_P(p->mem_ctx, struct srvsvc_NetSrvInfo102); r->out.info->info102->platform_id = 500; r->out.info->info102->version_major = lp_major_announce_version(); @@ -1138,7 +1138,7 @@ WERROR _srvsvc_NetSrvGetInfo(pipes_struct *p, struct srvsvc_NetSrvGetInfo *r) r->out.info->info102->comment = lp_serverstring(); break; case 101: - r->out.info->info101 = talloc_zero(p->mem_ctx, struct srvsvc_NetSrvInfo101); + r->out.info->info101 = TALLOC_ZERO_P(p->mem_ctx, struct srvsvc_NetSrvInfo101); r->out.info->info101->platform_id = 500; r->out.info->info101->server_name = global_myname(); r->out.info->info101->version_major = lp_major_announce_version(); @@ -1147,7 +1147,7 @@ WERROR _srvsvc_NetSrvGetInfo(pipes_struct *p, struct srvsvc_NetSrvGetInfo *r) r->out.info->info101->comment = lp_serverstring(); break; case 100: - r->out.info->info100 = talloc_zero(p->mem_ctx, struct srvsvc_NetSrvInfo100); + r->out.info->info100 = TALLOC_ZERO_P(p->mem_ctx, struct srvsvc_NetSrvInfo100); r->out.info->info100->platform_id = 500; r->out.info->info100->server_name = global_myname(); break; diff --git a/source3/smbd/conn.c b/source3/smbd/conn.c index 388cd004f9..a15684a35b 100644 --- a/source3/smbd/conn.c +++ b/source3/smbd/conn.c @@ -148,7 +148,7 @@ find_again: if (!(conn=TALLOC_ZERO_P(mem_ctx, connection_struct)) || !(conn->params = TALLOC_P(mem_ctx, struct share_params))) { - DEBUG(0,("talloc_zero() failed!\n")); + DEBUG(0,("TALLOC_ZERO() failed!\n")); TALLOC_FREE(mem_ctx); return NULL; } diff --git a/source3/smbd/fake_file.c b/source3/smbd/fake_file.c index 208b325667..5333742ba8 100644 --- a/source3/smbd/fake_file.c +++ b/source3/smbd/fake_file.c @@ -49,7 +49,7 @@ static struct _FAKE_FILE_HANDLE *init_fake_file_handle(enum FAKE_FILE_TYPE type) } if ((fh =TALLOC_ZERO_P(mem_ctx, FAKE_FILE_HANDLE))==NULL) { - DEBUG(0,("talloc_zero() failed.\n")); + DEBUG(0,("TALLOC_ZERO() failed.\n")); talloc_destroy(mem_ctx); return NULL; } diff --git a/source3/smbd/notify_inotify.c b/source3/smbd/notify_inotify.c index ff17d455f3..1b1bad7e96 100644 --- a/source3/smbd/notify_inotify.c +++ b/source3/smbd/notify_inotify.c @@ -235,7 +235,7 @@ static void inotify_handler(struct event_context *ev, struct fd_event *fde, return; } - e0 = e = (struct inotify_event *)talloc_size(in, bufsize); + e0 = e = (struct inotify_event *)TALLOC_SIZE(in, bufsize); if (e == NULL) return; if (read(in->fd, e0, bufsize) != bufsize) { diff --git a/source3/smbd/notify_internal.c b/source3/smbd/notify_internal.c index e1f47540e5..9f23db6671 100644 --- a/source3/smbd/notify_internal.c +++ b/source3/smbd/notify_internal.c @@ -156,7 +156,7 @@ static NTSTATUS notify_load(struct notify_context *notify) notify->seqnum = seqnum; talloc_free(notify->array); - notify->array = talloc_zero(notify, struct notify_array); + notify->array = TALLOC_ZERO_P(notify, struct notify_array); NT_STATUS_HAVE_NO_MEMORY(notify->array); dbuf = tdb_fetch_bystring(notify->w->tdb, NOTIFY_KEY); @@ -385,7 +385,7 @@ NTSTATUS notify_add(struct notify_context *notify, struct notify_entry *e0, depth = count_chars(e.path, '/'); - listel = talloc_zero(notify, struct notify_list); + listel = TALLOC_ZERO_P(notify, struct notify_list); if (listel == NULL) { status = NT_STATUS_NO_MEMORY; goto done; diff --git a/source3/smbd/ntquotas.c b/source3/smbd/ntquotas.c index e754583312..df851a2ca8 100644 --- a/source3/smbd/ntquotas.c +++ b/source3/smbd/ntquotas.c @@ -197,14 +197,14 @@ int vfs_get_user_ntquota_list(files_struct *fsp, SMB_NTQUOTA_LIST **qt_list) sid_string_static(&sid),fsp->conn->connectpath)); if ((tmp_list_ent=TALLOC_ZERO_P(mem_ctx,SMB_NTQUOTA_LIST))==NULL) { - DEBUG(0,("talloc_zero() failed\n")); + DEBUG(0,("TALLOC_ZERO() failed\n")); *qt_list = NULL; talloc_destroy(mem_ctx); return (-1); } if ((tmp_list_ent->quotas=TALLOC_ZERO_P(mem_ctx,SMB_NTQUOTA_STRUCT))==NULL) { - DEBUG(0,("talloc_zero() failed\n")); + DEBUG(0,("TALLOC_ZERO() failed\n")); *qt_list = NULL; talloc_destroy(mem_ctx); return (-1); @@ -231,7 +231,7 @@ void *init_quota_handle(TALLOC_CTX *mem_ctx) qt_handle = TALLOC_ZERO_P(mem_ctx,SMB_NTQUOTA_HANDLE); if (qt_handle==NULL) { - DEBUG(0,("talloc_zero() failed\n")); + DEBUG(0,("TALLOC_ZERO() failed\n")); return NULL; } diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index 1a4b43ce51..eb4a6cd969 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -2367,7 +2367,7 @@ static int call_nt_transact_ioctl(connection_struct *conn, char *inbuf, char *ou shadow_data = TALLOC_ZERO_P(shadow_mem_ctx,SHADOW_COPY_DATA); if (shadow_data == NULL) { - DEBUG(0,("talloc_zero() failed!\n")); + DEBUG(0,("TALLOC_ZERO() failed!\n")); talloc_destroy(shadow_mem_ctx); return ERROR_NT(NT_STATUS_NO_MEMORY); } diff --git a/source3/smbd/password.c b/source3/smbd/password.c index b7945bd7ea..ce03e6d85f 100644 --- a/source3/smbd/password.c +++ b/source3/smbd/password.c @@ -156,7 +156,7 @@ int register_vuid(auth_serversupplied_info *server_info, return UID_FIELD_INVALID; } - if((vuser = talloc_zero(NULL, user_struct)) == NULL) { + if((vuser = TALLOC_ZERO_P(NULL, user_struct)) == NULL) { DEBUG(0,("Failed to talloc users struct!\n")); data_blob_free(&session_key); return UID_FIELD_INVALID; diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 512b3162fa..91218fe9f4 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -3517,7 +3517,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd } /* Copy the lock range data. */ - lock_data = (char *)talloc_memdup( + lock_data = (char *)TALLOC_MEMDUP( data_ctx, pdata, total_data); if (!lock_data) { talloc_destroy(data_ctx); diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 0803ffb7e7..2fd448061e 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -159,7 +159,7 @@ BOOL vfs_init_custom(connection_struct *conn, const char *vfs_object) handle = TALLOC_ZERO_P(conn->mem_ctx,vfs_handle_struct); if (!handle) { - DEBUG(0,("talloc_zero() failed!\n")); + DEBUG(0,("TALLOC_ZERO() failed!\n")); SAFE_FREE(module_name); return False; } |