calls. No functional changes. Looks bigger than it is :-).
Jeremy.
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;
}
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;
}
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;
/* 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 */
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)
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;
}
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;
}
#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)
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 ) );
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;
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 );
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 );
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 );
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 );
}
/*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 ) {
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 );
/*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;
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 );
break;
}
- strings = talloc_array( mem_ctx, char *, num_strings );
+ strings = TALLOC_ARRAY( mem_ctx, char *, num_strings );
if ( !strings ) {
errno = ENOMEM;
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;
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;
}
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);
}
}
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;
}
}
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));
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;
}
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;
}
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"));
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;
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;
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;
}
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;
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;
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;
}
/* 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]);
( ! 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());
}
/**** 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());
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);
/* 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 */
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);
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);
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;
}
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 */
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;
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;
}
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;
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);
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;
}
}
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++) {
{
chaine2[l_chaine2] = '\0';
*string=(uint16 *)TALLOC_MEMDUP(prs_get_mem_context(ps),chaine2,realloc_size);
+ if (!*string) {
+ return False;
+ }
SAFE_FREE(chaine2);
}
/* 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,
if (UNMARSHALLING(ps)) {
if ( !(*sid2 = PRS_ALLOC_MEM(ps, DOM_SID2, 1)) )
- return False;
+ return False;
}
return True;
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]))
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))
{
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;
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) );
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)
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;
}
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;
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;
}
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)++) {
(*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;
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);
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;
(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))
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();
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();
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;
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;
}
}
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;
}
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) {
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);
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;
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);
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;
}
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);
}
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;
}
/* 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);
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;
}