From 73b377432c5efb8451f09f6d25d8aa1b28c239c9 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 7 Jun 2011 11:10:15 +1000 Subject: s3-talloc Change TALLOC_REALLOC_ARRAY() to talloc_realloc() Using the standard macro makes it easier to move code into common, as TALLOC_REALLOC_ARRAY isn't standard talloc. Andrew Bartlett --- lib/addns/dnsmarshall.c | 2 +- lib/addns/dnsrecord.c | 2 +- source3/include/smb_macros.h | 3 +-- source3/lib/charcnv.c | 4 ++-- source3/lib/ctdb_packet.c | 4 ++-- source3/lib/events.c | 4 ++-- source3/lib/messages_local.c | 2 +- source3/lib/util.c | 2 +- source3/lib/util_str.c | 4 ++-- source3/lib/util_tdb.c | 2 +- source3/libads/dns.c | 2 +- source3/libads/ldap.c | 4 ++-- source3/libgpo/gpo_reg.c | 2 +- source3/libnet/libnet_samsync_ldif.c | 4 ++-- source3/libsmb/clifile.c | 12 ++++++------ source3/libsmb/clilist.c | 8 ++++---- source3/libsmb/clirap.c | 2 +- source3/libsmb/clireadwrite.c | 2 +- source3/libsmb/namequery.c | 2 +- source3/modules/onefs_streams.c | 2 +- source3/modules/vfs_acl_xattr.c | 2 +- source3/modules/vfs_fileid.c | 2 +- source3/modules/vfs_preopen.c | 2 +- source3/modules/vfs_streams_depot.c | 2 +- source3/modules/vfs_streams_xattr.c | 6 +++--- source3/modules/vfs_xattr_tdb.c | 4 ++-- source3/nmbd/nmbd_packets.c | 4 ++-- source3/passdb/pdb_ldap.c | 2 +- source3/registry/reg_objects.c | 4 ++-- source3/registry/reg_perfcount.c | 20 ++++++++++---------- source3/rpc_client/cli_winreg.c | 2 +- source3/rpc_server/lsa/srv_lsa_nt.c | 2 +- source3/rpc_server/spoolss/srv_spoolss_nt.c | 22 +++++++++++----------- source3/rpc_server/srvsvc/srv_srvsvc_nt.c | 12 ++++++------ source3/rpcclient/cmd_lsarpc.c | 4 ++-- source3/smbd/dmapi.c | 2 +- source3/smbd/ipc.c | 2 +- source3/smbd/message.c | 2 +- source3/smbd/negprot.c | 2 +- source3/smbd/notify.c | 2 +- source3/smbd/process.c | 8 ++++---- source3/smbd/session.c | 2 +- source3/smbd/srvstr.c | 2 +- source3/smbd/trans2.c | 6 +++--- source3/utils/net_conf.c | 2 +- source3/winbindd/idmap_adex/gc_util.c | 4 ++-- source3/winbindd/wb_lookupsids.c | 4 ++-- source3/winbindd/winbindd_cache.c | 2 +- source3/winbindd/winbindd_cm.c | 4 ++-- source3/winbindd/winbindd_dual_srv.c | 8 ++++---- source3/winbindd/winbindd_rpc.c | 6 +++--- 51 files changed, 108 insertions(+), 109 deletions(-) diff --git a/lib/addns/dnsmarshall.c b/lib/addns/dnsmarshall.c index 5530290c57..e5e8cf7962 100644 --- a/lib/addns/dnsmarshall.c +++ b/lib/addns/dnsmarshall.c @@ -78,7 +78,7 @@ void dns_marshall_buffer(struct dns_buffer *buf, const uint8 *data, new_size += (64 - (new_size % 64)); - if (!(new_data = TALLOC_REALLOC_ARRAY(buf, buf->data, uint8, + if (!(new_data = talloc_realloc(buf, buf->data, uint8, new_size))) { buf->error = ERROR_DNS_NO_MEMORY; return; diff --git a/lib/addns/dnsrecord.c b/lib/addns/dnsrecord.c index 528fdf29ab..52391aef78 100644 --- a/lib/addns/dnsrecord.c +++ b/lib/addns/dnsrecord.c @@ -308,7 +308,7 @@ DNS_ERROR dns_add_rrec(TALLOC_CTX *mem_ctx, struct dns_rrec *rec, { struct dns_rrec **new_records; - if (!(new_records = TALLOC_REALLOC_ARRAY(mem_ctx, *records, + if (!(new_records = talloc_realloc(mem_ctx, *records, struct dns_rrec *, (*num_records)+1))) { return ERROR_DNS_NO_MEMORY; diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h index ccf99daaea..cb364a9aa3 100644 --- a/source3/include/smb_macros.h +++ b/source3/include/smb_macros.h @@ -229,7 +229,6 @@ copy an IP address from one buffer to another #define TALLOC_ZERO_SIZE(ctx, size) _talloc_zero(ctx, size, __location__) #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) #ifndef TALLOC_FREE #define TALLOC_FREE(ctx) do { talloc_free(ctx); ctx=NULL; } while(0) @@ -292,7 +291,7 @@ copy an IP address from one buffer to another #define ADD_TO_ARRAY(mem_ctx, type, elem, array, num) \ do { \ *(array) = ((mem_ctx) != NULL) ? \ - TALLOC_REALLOC_ARRAY(mem_ctx, (*(array)), type, (*(num))+1) : \ + talloc_realloc(mem_ctx, (*(array)), type, (*(num))+1) : \ SMB_REALLOC_ARRAY((*(array)), type, (*(num))+1); \ SMB_ASSERT((*(array)) != NULL); \ (*(array))[*(num)] = (elem); \ diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c index 1e44b81af9..17e836dfe0 100644 --- a/source3/lib/charcnv.c +++ b/source3/lib/charcnv.c @@ -202,7 +202,7 @@ static size_t pull_ascii_base_talloc(TALLOC_CTX *ctx, /* Have we got space to append the '\0' ? */ if (size <= dest_len) { /* No, realloc. */ - dest = TALLOC_REALLOC_ARRAY(ctx, dest, char, + dest = talloc_realloc(ctx, dest, char, dest_len+1); if (!dest) { /* talloc fail. */ @@ -449,7 +449,7 @@ static size_t pull_ucs2_base_talloc(TALLOC_CTX *ctx, /* Have we got space to append the '\0' ? */ if (size <= dest_len) { /* No, realloc. */ - dest = TALLOC_REALLOC_ARRAY(ctx, dest, char, + dest = talloc_realloc(ctx, dest, char, dest_len+1); if (!dest) { /* talloc fail. */ diff --git a/source3/lib/ctdb_packet.c b/source3/lib/ctdb_packet.c index 03be372f19..35c76fa44f 100644 --- a/source3/lib/ctdb_packet.c +++ b/source3/lib/ctdb_packet.c @@ -82,7 +82,7 @@ NTSTATUS ctdb_packet_fd_read(struct ctdb_packet_context *ctx) return NT_STATUS_NO_MEMORY; } - if (!(in = TALLOC_REALLOC_ARRAY(ctx, ctx->in.data, uint8, new_size))) { + if (!(in = talloc_realloc(ctx, ctx->in.data, uint8, new_size))) { DEBUG(10, ("talloc failed\n")); return NT_STATUS_NO_MEMORY; } @@ -245,7 +245,7 @@ NTSTATUS ctdb_packet_send(struct ctdb_packet_context *ctx, int num_blobs, ...) return NT_STATUS_OK; } - if (!(out = TALLOC_REALLOC_ARRAY(ctx, ctx->out.data, uint8, len))) { + if (!(out = talloc_realloc(ctx, ctx->out.data, uint8, len))) { DEBUG(0, ("talloc failed\n")); return NT_STATUS_NO_MEMORY; } diff --git a/source3/lib/events.c b/source3/lib/events.c index fbe3db942b..fc7f1d493a 100644 --- a/source3/lib/events.c +++ b/source3/lib/events.c @@ -90,7 +90,7 @@ bool event_add_to_poll_args(struct tevent_context *ev, TALLOC_CTX *mem_ctx, idx_len = max_fd+1; if (talloc_array_length(state->pollfd_idx) < idx_len) { - state->pollfd_idx = TALLOC_REALLOC_ARRAY( + state->pollfd_idx = talloc_realloc( state, state->pollfd_idx, int, idx_len); if (state->pollfd_idx == NULL) { DEBUG(10, ("talloc_realloc failed\n")); @@ -107,7 +107,7 @@ bool event_add_to_poll_args(struct tevent_context *ev, TALLOC_CTX *mem_ctx, */ if (talloc_array_length(fds) < num_pollfds + num_fds + 1) { - fds = TALLOC_REALLOC_ARRAY(mem_ctx, fds, struct pollfd, + fds = talloc_realloc(mem_ctx, fds, struct pollfd, num_pollfds + num_fds + 1); if (fds == NULL) { DEBUG(10, ("talloc_realloc failed\n")); diff --git a/source3/lib/messages_local.c b/source3/lib/messages_local.c index f82b107bcc..9bfe6e68e0 100644 --- a/source3/lib/messages_local.c +++ b/source3/lib/messages_local.c @@ -371,7 +371,7 @@ static NTSTATUS messaging_tdb_send(struct messaging_context *msg_ctx, goto done; } - if (!(rec = TALLOC_REALLOC_ARRAY(talloc_tos(), msg_array->messages, + if (!(rec = talloc_realloc(talloc_tos(), msg_array->messages, struct messaging_rec, msg_array->num_messages+1))) { status = NT_STATUS_NO_MEMORY; diff --git a/source3/lib/util.c b/source3/lib/util.c index 5aad243593..b4af9fbc0e 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -226,7 +226,7 @@ ssize_t message_push_blob(uint8 **outbuf, DATA_BLOB blob) size_t newlen = smb_len(*outbuf) + 4 + blob.length; uint8 *tmp; - if (!(tmp = TALLOC_REALLOC_ARRAY(NULL, *outbuf, uint8, newlen))) { + if (!(tmp = talloc_realloc(NULL, *outbuf, uint8, newlen))) { DEBUG(0, ("talloc failed\n")); return -1; } diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index f039a3a522..6fe8f67448 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -948,7 +948,7 @@ void sprintf_append(TALLOC_CTX *mem_ctx, char **string, ssize_t *len, } if (increased) { - *string = TALLOC_REALLOC_ARRAY(mem_ctx, *string, char, + *string = talloc_realloc(mem_ctx, *string, char, *bufsize); if (*string == NULL) { goto error; @@ -1253,7 +1253,7 @@ char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string, lsize += S_LIST_ABS; - tmp = TALLOC_REALLOC_ARRAY(mem_ctx, list, char *, + tmp = talloc_realloc(mem_ctx, list, char *, lsize + 1); if (tmp == NULL) { DEBUG(0,("str_list_make: " diff --git a/source3/lib/util_tdb.c b/source3/lib/util_tdb.c index 654a538a88..5c3dc3a07d 100644 --- a/source3/lib/util_tdb.c +++ b/source3/lib/util_tdb.c @@ -231,7 +231,7 @@ bool tdb_pack_append(TALLOC_CTX *mem_ctx, uint8 **buf, size_t *len, va_end(ap); if (mem_ctx != NULL) { - *buf = TALLOC_REALLOC_ARRAY(mem_ctx, *buf, uint8, + *buf = talloc_realloc(mem_ctx, *buf, uint8, (*len) + len1); } else { *buf = SMB_REALLOC_ARRAY(*buf, uint8, (*len) + len1); diff --git a/source3/libads/dns.c b/source3/libads/dns.c index 152003941b..08180a65c0 100644 --- a/source3/libads/dns.c +++ b/source3/libads/dns.c @@ -540,7 +540,7 @@ static NTSTATUS ads_dns_lookup_srv( TALLOC_CTX *ctx, return NT_STATUS_NO_MEMORY; } } else { - if ((tmp_ss_s = TALLOC_REALLOC_ARRAY(dcs, + if ((tmp_ss_s = talloc_realloc(dcs, dcs[i].ss_s, struct sockaddr_storage, dcs[i].num_ips+1)) diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index 375dc3bf27..f39e6ede5c 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -1422,7 +1422,7 @@ static ADS_STATUS ads_modlist_add(TALLOC_CTX *ctx, ADS_MODLIST *mods, for (curmod=0; modlist[curmod] && modlist[curmod] != (LDAPMod *) -1; curmod++); if (modlist[curmod] == (LDAPMod *) -1) { - if (!(modlist = TALLOC_REALLOC_ARRAY(ctx, modlist, LDAPMod *, + if (!(modlist = talloc_realloc(ctx, modlist, LDAPMod *, curmod+ADS_MODLIST_ALLOC_SIZE+1))) return ADS_ERROR(LDAP_NO_MEMORY); memset(&modlist[curmod], 0, @@ -2546,7 +2546,7 @@ int ads_count_replies(ADS_STRUCT *ads, void *res) return NULL; } - strings = TALLOC_REALLOC_ARRAY(mem_ctx, current_strings, char *, + strings = talloc_realloc(mem_ctx, current_strings, char *, *num_strings + num_new_strings); if (strings == NULL) { diff --git a/source3/libgpo/gpo_reg.c b/source3/libgpo/gpo_reg.c index d9fcd43caf..29b31aec8e 100644 --- a/source3/libgpo/gpo_reg.c +++ b/source3/libgpo/gpo_reg.c @@ -901,7 +901,7 @@ bool add_gp_registry_entry_to_array(TALLOC_CTX *mem_ctx, struct gp_registry_entry **entries, size_t *num) { - *entries = TALLOC_REALLOC_ARRAY(mem_ctx, *entries, + *entries = talloc_realloc(mem_ctx, *entries, struct gp_registry_entry, (*num)+1); diff --git a/source3/libnet/libnet_samsync_ldif.c b/source3/libnet/libnet_samsync_ldif.c index 3f7fb347dd..bcdcd48ecf 100644 --- a/source3/libnet/libnet_samsync_ldif.c +++ b/source3/libnet/libnet_samsync_ldif.c @@ -1200,12 +1200,12 @@ static NTSTATUS ldif_realloc_maps(TALLOC_CTX *mem_ctx, uint32_t num_entries) { /* Re-allocate memory for groupmap and accountmap arrays */ - l->groupmap = TALLOC_REALLOC_ARRAY(mem_ctx, + l->groupmap = talloc_realloc(mem_ctx, l->groupmap, GROUPMAP, num_entries + l->num_alloced); - l->accountmap = TALLOC_REALLOC_ARRAY(mem_ctx, + l->accountmap = talloc_realloc(mem_ctx, l->accountmap, ACCOUNTMAP, num_entries + l->num_alloced); diff --git a/source3/libsmb/clifile.c b/source3/libsmb/clifile.c index 1bf72aaf8f..8b76e8f5d8 100644 --- a/source3/libsmb/clifile.c +++ b/source3/libsmb/clifile.c @@ -52,7 +52,7 @@ static uint8_t *internal_bytes_push_str(uint8_t *buf, bool ucs2, /* * We're pushing into an SMB buffer, align odd */ - buf = TALLOC_REALLOC_ARRAY(NULL, buf, uint8_t, buflen + 1); + buf = talloc_realloc(NULL, buf, uint8_t, buflen + 1); if (buf == NULL) { return NULL; } @@ -67,7 +67,7 @@ static uint8_t *internal_bytes_push_str(uint8_t *buf, bool ucs2, return NULL; } - buf = TALLOC_REALLOC_ARRAY(NULL, buf, uint8_t, + buf = talloc_realloc(NULL, buf, uint8_t, buflen + converted_size); if (buf == NULL) { TALLOC_FREE(converted); @@ -108,7 +108,7 @@ uint8_t *smb_bytes_push_bytes(uint8_t *buf, uint8_t prefix, } buflen = talloc_get_size(buf); - buf = TALLOC_REALLOC_ARRAY(NULL, buf, uint8_t, + buf = talloc_realloc(NULL, buf, uint8_t, buflen + 1 + num_bytes); if (buf == NULL) { return NULL; @@ -1031,7 +1031,7 @@ struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - bytes = TALLOC_REALLOC_ARRAY(state, bytes, uint8_t, + bytes = talloc_realloc(state, bytes, uint8_t, talloc_get_size(bytes)+1); if (tevent_req_nomem(bytes, req)) { return tevent_req_post(req, ev); @@ -1153,7 +1153,7 @@ static struct tevent_req *cli_ntrename_internal_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - bytes = TALLOC_REALLOC_ARRAY(state, bytes, uint8_t, + bytes = talloc_realloc(state, bytes, uint8_t, talloc_get_size(bytes)+1); if (tevent_req_nomem(bytes, req)) { return tevent_req_post(req, ev); @@ -3349,7 +3349,7 @@ struct tevent_req *cli_setatr_send(TALLOC_CTX *mem_ctx, if (tevent_req_nomem(bytes, req)) { return tevent_req_post(req, ev); } - bytes = TALLOC_REALLOC_ARRAY(state, bytes, uint8_t, + bytes = talloc_realloc(state, bytes, uint8_t, talloc_get_size(bytes)+1); if (tevent_req_nomem(bytes, req)) { return tevent_req_post(req, ev); diff --git a/source3/libsmb/clilist.c b/source3/libsmb/clilist.c index 49354e66bd..83cc81549a 100644 --- a/source3/libsmb/clilist.c +++ b/source3/libsmb/clilist.c @@ -387,7 +387,7 @@ static void cli_list_old_done(struct tevent_req *subreq) dirlist_len = talloc_get_size(state->dirlist); - tmp = TALLOC_REALLOC_ARRAY( + tmp = talloc_realloc( state, state->dirlist, uint8_t, dirlist_len + received * DIR_STRUCT_SIZE); if (tevent_req_nomem(tmp, req)) { @@ -654,7 +654,7 @@ static void cli_list_trans_done(struct tevent_req *subreq) old_num_finfo = talloc_array_length(state->finfo); - tmp = TALLOC_REALLOC_ARRAY(state, state->finfo, struct file_info, + tmp = talloc_realloc(state, state->finfo, struct file_info, old_num_finfo + ff_searchcount); if (tevent_req_nomem(tmp, req)) { return; @@ -711,7 +711,7 @@ static void cli_list_trans_done(struct tevent_req *subreq) /* * Shrink state->finfo to the real length we received */ - tmp = TALLOC_REALLOC_ARRAY(state, state->finfo, struct file_info, + tmp = talloc_realloc(state, state->finfo, struct file_info, old_num_finfo + i); if (tevent_req_nomem(tmp, req)) { return; @@ -736,7 +736,7 @@ static void cli_list_trans_done(struct tevent_req *subreq) nlen = 2*(strlen(state->mask) + 1); - param = TALLOC_REALLOC_ARRAY(state, state->param, uint8_t, + param = talloc_realloc(state, state->param, uint8_t, 12 + nlen + last_name_raw.length + 2); if (tevent_req_nomem(param, req)) { return; diff --git a/source3/libsmb/clirap.c b/source3/libsmb/clirap.c index 3e5f08dd3c..008db0b65a 100644 --- a/source3/libsmb/clirap.c +++ b/source3/libsmb/clirap.c @@ -998,7 +998,7 @@ static bool parse_streams_blob(TALLOC_CTX *mem_ctx, const uint8_t *rdata, struct stream_struct *tmp; uint8_t *tmp_buf; - tmp = TALLOC_REALLOC_ARRAY(mem_ctx, streams, + tmp = talloc_realloc(mem_ctx, streams, struct stream_struct, num_streams+1); diff --git a/source3/libsmb/clireadwrite.c b/source3/libsmb/clireadwrite.c index 9f228c9b08..fc6c9ffc00 100644 --- a/source3/libsmb/clireadwrite.c +++ b/source3/libsmb/clireadwrite.c @@ -722,7 +722,7 @@ NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf, SIVAL(vwv+2, 0, offset); SSVAL(vwv+4, 0, 0); - bytes = TALLOC_REALLOC_ARRAY(talloc_tos(), bytes, uint8_t, + bytes = talloc_realloc(talloc_tos(), bytes, uint8_t, size+3); if (bytes == NULL) { return NT_STATUS_NO_MEMORY; diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c index 2ad10710a9..eec42ff622 100644 --- a/source3/libsmb/namequery.c +++ b/source3/libsmb/namequery.c @@ -1317,7 +1317,7 @@ static bool name_query_validator(struct packet_struct *p, void *private_data) return false; } - tmp_addrs = TALLOC_REALLOC_ARRAY( + tmp_addrs = talloc_realloc( state, state->addrs, struct sockaddr_storage, state->num_addrs + nmb->answers->rdlength/6); if (tmp_addrs == NULL) { diff --git a/source3/modules/onefs_streams.c b/source3/modules/onefs_streams.c index 2634ea77a1..78230bcad6 100644 --- a/source3/modules/onefs_streams.c +++ b/source3/modules/onefs_streams.c @@ -552,7 +552,7 @@ static bool add_one_stream(TALLOC_CTX *mem_ctx, unsigned int *num_streams, { struct stream_struct *tmp; - tmp = TALLOC_REALLOC_ARRAY(mem_ctx, *streams, struct stream_struct, + tmp = talloc_realloc(mem_ctx, *streams, struct stream_struct, (*num_streams)+1); if (tmp == NULL) { return false; diff --git a/source3/modules/vfs_acl_xattr.c b/source3/modules/vfs_acl_xattr.c index 2a83430fa9..70e979b71b 100644 --- a/source3/modules/vfs_acl_xattr.c +++ b/source3/modules/vfs_acl_xattr.c @@ -55,7 +55,7 @@ static NTSTATUS get_acl_blob(TALLOC_CTX *ctx, again: - tmp = TALLOC_REALLOC_ARRAY(ctx, val, uint8_t, size); + tmp = talloc_realloc(ctx, val, uint8_t, size); if (tmp == NULL) { TALLOC_FREE(val); return NT_STATUS_NO_MEMORY; diff --git a/source3/modules/vfs_fileid.c b/source3/modules/vfs_fileid.c index 642628082a..1168d50cb2 100644 --- a/source3/modules/vfs_fileid.c +++ b/source3/modules/vfs_fileid.c @@ -66,7 +66,7 @@ static void fileid_load_mount_entries(struct fileid_handle_data *data) m->mnt_fsname += 5; } - data->mount_entries = TALLOC_REALLOC_ARRAY(data, + data->mount_entries = talloc_realloc(data, data->mount_entries, struct fileid_mount_entry, data->num_mount_entries+1); diff --git a/source3/modules/vfs_preopen.c b/source3/modules/vfs_preopen.c index e0d1fd7ec0..b29a4c4351 100644 --- a/source3/modules/vfs_preopen.c +++ b/source3/modules/vfs_preopen.c @@ -166,7 +166,7 @@ static bool preopen_helper_open_one(int sock_fd, char **pnamebuf, nread += thistime; if (nread == talloc_get_size(namebuf)) { - namebuf = TALLOC_REALLOC_ARRAY( + namebuf = talloc_realloc( NULL, namebuf, char, talloc_get_size(namebuf) * 2); if (namebuf == NULL) { diff --git a/source3/modules/vfs_streams_depot.c b/source3/modules/vfs_streams_depot.c index f1c687e952..3569405da3 100644 --- a/source3/modules/vfs_streams_depot.c +++ b/source3/modules/vfs_streams_depot.c @@ -716,7 +716,7 @@ static bool add_one_stream(TALLOC_CTX *mem_ctx, unsigned int *num_streams, { struct stream_struct *tmp; - tmp = TALLOC_REALLOC_ARRAY(mem_ctx, *streams, struct stream_struct, + tmp = talloc_realloc(mem_ctx, *streams, struct stream_struct, (*num_streams)+1); if (tmp == NULL) { return false; diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c index 3a001e445c..2772c96c4d 100644 --- a/source3/modules/vfs_streams_xattr.c +++ b/source3/modules/vfs_streams_xattr.c @@ -731,7 +731,7 @@ static bool add_one_stream(TALLOC_CTX *mem_ctx, unsigned int *num_streams, { struct stream_struct *tmp; - tmp = TALLOC_REALLOC_ARRAY(mem_ctx, *streams, struct stream_struct, + tmp = talloc_realloc(mem_ctx, *streams, struct stream_struct, (*num_streams)+1); if (tmp == NULL) { return false; @@ -880,7 +880,7 @@ static ssize_t streams_xattr_pwrite(vfs_handle_struct *handle, if ((offset + n) > ea.value.length-1) { uint8 *tmp; - tmp = TALLOC_REALLOC_ARRAY(talloc_tos(), ea.value.data, uint8, + tmp = talloc_realloc(talloc_tos(), ea.value.data, uint8, offset + n + 1); if (tmp == NULL) { @@ -986,7 +986,7 @@ static int streams_xattr_ftruncate(struct vfs_handle_struct *handle, return -1; } - tmp = TALLOC_REALLOC_ARRAY(talloc_tos(), ea.value.data, uint8, + tmp = talloc_realloc(talloc_tos(), ea.value.data, uint8, offset + 1); if (tmp == NULL) { diff --git a/source3/modules/vfs_xattr_tdb.c b/source3/modules/vfs_xattr_tdb.c index 2cfea9cacd..23bb35041e 100644 --- a/source3/modules/vfs_xattr_tdb.c +++ b/source3/modules/vfs_xattr_tdb.c @@ -299,12 +299,12 @@ static int xattr_tdb_setattr(struct db_context *db_ctx, return -1; } - tmp = TALLOC_REALLOC_ARRAY( + tmp = talloc_realloc( attribs, attribs->eas, struct xattr_EA, attribs->num_eas+ 1); if (tmp == NULL) { - DEBUG(0, ("TALLOC_REALLOC_ARRAY failed\n")); + DEBUG(0, ("talloc_realloc failed\n")); TALLOC_FREE(rec); errno = ENOMEM; return -1; diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c index f414c9c862..12e3ab17e3 100644 --- a/source3/nmbd/nmbd_packets.c +++ b/source3/nmbd/nmbd_packets.c @@ -1885,7 +1885,7 @@ bool listen_for_packets(bool run_election) * create_listen_pollfds. */ - fds = TALLOC_REALLOC_ARRAY(NULL, fds, struct pollfd, listen_number); + fds = talloc_realloc(NULL, fds, struct pollfd, listen_number); if (fds == NULL) { return true; } @@ -1894,7 +1894,7 @@ bool listen_for_packets(bool run_election) #ifndef SYNC_DNS dns_fd = asyncdns_fd(); if (dns_fd != -1) { - fds = TALLOC_REALLOC_ARRAY(NULL, fds, struct pollfd, num_sockets+1); + fds = talloc_realloc(NULL, fds, struct pollfd, num_sockets+1); if (fds == NULL) { return true; } diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c index aef1d31eb6..c21b54f74d 100644 --- a/source3/passdb/pdb_ldap.c +++ b/source3/passdb/pdb_ldap.c @@ -1532,7 +1532,7 @@ static void append_attr(TALLOC_CTX *mem_ctx, const char ***attr_list, ; } - (*attr_list) = TALLOC_REALLOC_ARRAY(mem_ctx, (*attr_list), + (*attr_list) = talloc_realloc(mem_ctx, (*attr_list), const char *, i+2); SMB_ASSERT((*attr_list) != NULL); (*attr_list)[i] = talloc_strdup((*attr_list), new_attr); diff --git a/source3/registry/reg_objects.c b/source3/registry/reg_objects.c index 980986f95b..389975587d 100644 --- a/source3/registry/reg_objects.c +++ b/source3/registry/reg_objects.c @@ -211,7 +211,7 @@ WERROR regsubkey_ctr_addkey( struct regsubkey_ctr *ctr, const char *keyname ) return WERR_OK; } - if (!(newkeys = TALLOC_REALLOC_ARRAY(ctr, ctr->subkeys, char *, + if (!(newkeys = talloc_realloc(ctr, ctr->subkeys, char *, ctr->num_subkeys+1))) { return WERR_NOMEM; } @@ -507,7 +507,7 @@ int regval_ctr_addvalue(struct regval_ctr *ctr, const char *name, uint32_t type, if ( ctr->num_values == 0 ) { ctr->values = TALLOC_P( ctr, struct regval_blob *); } else { - ctr->values = TALLOC_REALLOC_ARRAY(ctr, ctr->values, + ctr->values = talloc_realloc(ctr, ctr->values, struct regval_blob *, ctr->num_values+1); } diff --git a/source3/registry/reg_perfcount.c b/source3/registry/reg_perfcount.c index 8a2b444e01..1ba8915b4c 100644 --- a/source3/registry/reg_perfcount.c +++ b/source3/registry/reg_perfcount.c @@ -376,7 +376,7 @@ static bool _reg_perfcount_add_object(struct PERF_DATA_BLOCK *block, bool success = True; struct PERF_OBJECT_TYPE *obj; - block->objects = (struct PERF_OBJECT_TYPE *)TALLOC_REALLOC_ARRAY(mem_ctx, + block->objects = (struct PERF_OBJECT_TYPE *)talloc_realloc(mem_ctx, block->objects, struct PERF_OBJECT_TYPE, block->NumObjectTypes+1); @@ -547,7 +547,7 @@ static bool _reg_perfcount_get_counter_info(struct PERF_DATA_BLOCK *block, SAFE_FREE(data.dptr); obj->counter_data.ByteLength += dsize + padding; - obj->counter_data.data = TALLOC_REALLOC_ARRAY(mem_ctx, + obj->counter_data.data = talloc_realloc(mem_ctx, obj->counter_data.data, uint8, obj->counter_data.ByteLength - sizeof(uint32)); @@ -635,7 +635,7 @@ static bool _reg_perfcount_add_counter(struct PERF_DATA_BLOCK *block, parent, num)); return False; } - obj->counters = (struct PERF_COUNTER_DEFINITION *)TALLOC_REALLOC_ARRAY(mem_ctx, + obj->counters = (struct PERF_COUNTER_DEFINITION *)talloc_realloc(mem_ctx, obj->counters, struct PERF_COUNTER_DEFINITION, obj->NumCounters+1); @@ -687,7 +687,7 @@ static bool _reg_perfcount_get_instance_info(struct PERF_INSTANCE_DEFINITION *in return False; } inst->counter_data.ByteLength = data.dsize + sizeof(inst->counter_data.ByteLength); - inst->counter_data.data = TALLOC_REALLOC_ARRAY(mem_ctx, + inst->counter_data.data = talloc_realloc(mem_ctx, inst->counter_data.data, uint8, data.dsize); @@ -719,7 +719,7 @@ static bool _reg_perfcount_get_instance_info(struct PERF_INSTANCE_DEFINITION *in SAFE_FREE(data.dptr); return False; } - inst->data = TALLOC_REALLOC_ARRAY(mem_ctx, + inst->data = talloc_realloc(mem_ctx, inst->data, uint8, inst->NameLength); @@ -741,7 +741,7 @@ static bool _reg_perfcount_get_instance_info(struct PERF_INSTANCE_DEFINITION *in if((pad = (inst->ByteLength % 8))) { pad = 8 - pad; - inst->data = TALLOC_REALLOC_ARRAY(mem_ctx, + inst->data = talloc_realloc(mem_ctx, inst->data, uint8, inst->NameLength + pad); @@ -763,7 +763,7 @@ static bool _reg_perfcount_add_instance(struct PERF_OBJECT_TYPE *obj, struct PERF_INSTANCE_DEFINITION *inst; if(obj->instances == NULL) { - obj->instances = TALLOC_REALLOC_ARRAY(mem_ctx, + obj->instances = talloc_realloc(mem_ctx, obj->instances, struct PERF_INSTANCE_DEFINITION, obj->NumInstances); @@ -993,7 +993,7 @@ static uint32 _reg_perfcount_perf_data_block_fixup(struct PERF_DATA_BLOCK *block counter_data = &(instance->counter_data); counter = &(object[obj].counters[object[obj].NumCounters - 1]); counter_data->ByteLength = counter->CounterOffset + counter->CounterSize + sizeof(counter_data->ByteLength); - temp = TALLOC_REALLOC_ARRAY(mem_ctx, + temp = talloc_realloc(mem_ctx, temp, char, counter_data->ByteLength- sizeof(counter_data->ByteLength)); @@ -1014,7 +1014,7 @@ static uint32 _reg_perfcount_perf_data_block_fixup(struct PERF_DATA_BLOCK *block { pad = 8 - pad; } - counter_data->data = TALLOC_REALLOC_ARRAY(mem_ctx, + counter_data->data = talloc_realloc(mem_ctx, counter_data->data, uint8, counter_data->ByteLength - sizeof(counter_data->ByteLength) + pad); @@ -1034,7 +1034,7 @@ static uint32 _reg_perfcount_perf_data_block_fixup(struct PERF_DATA_BLOCK *block if((pad = (object[obj].counter_data.ByteLength % 8))) { pad = 8 - pad; - object[obj].counter_data.data = TALLOC_REALLOC_ARRAY(mem_ctx, + object[obj].counter_data.data = talloc_realloc(mem_ctx, object[obj].counter_data.data, uint8, object[obj].counter_data.ByteLength + pad); diff --git a/source3/rpc_client/cli_winreg.c b/source3/rpc_client/cli_winreg.c index 2517dbc50a..3731fc7e79 100644 --- a/source3/rpc_client/cli_winreg.c +++ b/source3/rpc_client/cli_winreg.c @@ -615,7 +615,7 @@ NTSTATUS dcerpc_winreg_add_multi_sz(TALLOC_CTX *mem_ctx, /* count the elements */ for (p = a, i = 0; p && *p; p++, i++); - p = TALLOC_REALLOC_ARRAY(mem_ctx, a, const char *, i + 2); + p = talloc_realloc(mem_ctx, a, const char *, i + 2); if (p == NULL) { *pwerr = WERR_NOMEM; return NT_STATUS_OK; diff --git a/source3/rpc_server/lsa/srv_lsa_nt.c b/source3/rpc_server/lsa/srv_lsa_nt.c index da0f697dc9..393dc31454 100644 --- a/source3/rpc_server/lsa/srv_lsa_nt.c +++ b/source3/rpc_server/lsa/srv_lsa_nt.c @@ -122,7 +122,7 @@ static int init_lsa_ref_domain_list(TALLOC_CTX *mem_ctx, ref->count = num + 1; ref->max_size = LSA_REF_DOMAIN_LIST_MULTIPLIER; - ref->domains = TALLOC_REALLOC_ARRAY(mem_ctx, ref->domains, + ref->domains = talloc_realloc(mem_ctx, ref->domains, struct lsa_DomainInfo, ref->count); if (!ref->domains) { return -1; diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index a946bc91d0..6b037232a6 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -1094,7 +1094,7 @@ static int notify_msg_ctr_addmsg( SPOOLSS_NOTIFY_MSG_CTR *ctr, SPOOLSS_NOTIFY_MS if ( i == ctr->num_groups ) { ctr->num_groups++; - if ( !(groups = TALLOC_REALLOC_ARRAY( ctr->ctx, ctr->msg_groups, SPOOLSS_NOTIFY_MSG_GROUP, ctr->num_groups)) ) { + if ( !(groups = talloc_realloc( ctr->ctx, ctr->msg_groups, SPOOLSS_NOTIFY_MSG_GROUP, ctr->num_groups)) ) { DEBUG(0,("notify_msg_ctr_addmsg: talloc_realloc() failed!\n")); return 0; } @@ -1112,7 +1112,7 @@ static int notify_msg_ctr_addmsg( SPOOLSS_NOTIFY_MSG_CTR *ctr, SPOOLSS_NOTIFY_MS msg_grp->num_msgs++; - if ( !(msg_list = TALLOC_REALLOC_ARRAY( ctr->ctx, msg_grp->msgs, SPOOLSS_NOTIFY_MSG, msg_grp->num_msgs )) ) { + if ( !(msg_list = talloc_realloc( ctr->ctx, msg_grp->msgs, SPOOLSS_NOTIFY_MSG, msg_grp->num_msgs )) ) { DEBUG(0,("notify_msg_ctr_addmsg: talloc_realloc() failed for new message [%d]!\n", msg_grp->num_msgs)); return 0; } @@ -3438,7 +3438,7 @@ static bool construct_notify_printer_info(struct messaging_context *msg_ctx, if (!search_notify(type, field, &j) ) continue; - info->notifies = TALLOC_REALLOC_ARRAY(info, info->notifies, + info->notifies = talloc_realloc(info, info->notifies, struct spoolss_Notify, info->count + 1); if (info->notifies == NULL) { @@ -3498,7 +3498,7 @@ static bool construct_notify_jobs_info(struct messaging_context *msg_ctx, if (!search_notify(type, field, &j) ) continue; - info->notifies = TALLOC_REALLOC_ARRAY(info, info->notifies, + info->notifies = talloc_realloc(info, info->notifies, struct spoolss_Notify, info->count + 1); if (info->notifies == NULL) { @@ -4307,7 +4307,7 @@ static WERROR enum_all_printers_info_level(TALLOC_CTX *mem_ctx, goto out; } - info = TALLOC_REALLOC_ARRAY(mem_ctx, info, + info = talloc_realloc(mem_ctx, info, union spoolss_PrinterInfo, count + 1); if (!info) { @@ -5347,7 +5347,7 @@ static WERROR spoolss_DriverFileInfo_from_driver(TALLOC_CTX *mem_ctx, *count_p = 0; if (strlen(driver->driver_path)) { - info = TALLOC_REALLOC_ARRAY(mem_ctx, info, + info = talloc_realloc(mem_ctx, info, struct spoolss_DriverFileInfo, count + 1); W_ERROR_HAVE_NO_MEMORY(info); @@ -5362,7 +5362,7 @@ static WERROR spoolss_DriverFileInfo_from_driver(TALLOC_CTX *mem_ctx, } if (strlen(driver->config_file)) { - info = TALLOC_REALLOC_ARRAY(mem_ctx, info, + info = talloc_realloc(mem_ctx, info, struct spoolss_DriverFileInfo, count + 1); W_ERROR_HAVE_NO_MEMORY(info); @@ -5377,7 +5377,7 @@ static WERROR spoolss_DriverFileInfo_from_driver(TALLOC_CTX *mem_ctx, } if (strlen(driver->data_file)) { - info = TALLOC_REALLOC_ARRAY(mem_ctx, info, + info = talloc_realloc(mem_ctx, info, struct spoolss_DriverFileInfo, count + 1); W_ERROR_HAVE_NO_MEMORY(info); @@ -5392,7 +5392,7 @@ static WERROR spoolss_DriverFileInfo_from_driver(TALLOC_CTX *mem_ctx, } if (strlen(driver->help_file)) { - info = TALLOC_REALLOC_ARRAY(mem_ctx, info, + info = talloc_realloc(mem_ctx, info, struct spoolss_DriverFileInfo, count + 1); W_ERROR_HAVE_NO_MEMORY(info); @@ -5407,7 +5407,7 @@ static WERROR spoolss_DriverFileInfo_from_driver(TALLOC_CTX *mem_ctx, } for (i=0; driver->dependent_files[i] && driver->dependent_files[i][0] != '\0'; i++) { - info = TALLOC_REALLOC_ARRAY(mem_ctx, info, + info = talloc_realloc(mem_ctx, info, struct spoolss_DriverFileInfo, count + 1); W_ERROR_HAVE_NO_MEMORY(info); @@ -7292,7 +7292,7 @@ static WERROR enumprinterdrivers_level_by_architecture(TALLOC_CTX *mem_ctx, num_drivers, architecture, version)); if (num_drivers != 0) { - info = TALLOC_REALLOC_ARRAY(mem_ctx, info, + info = talloc_realloc(mem_ctx, info, union spoolss_DriverInfo, count + num_drivers); if (!info) { diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c index 7251d70dd9..c63a81dd77 100644 --- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c +++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c @@ -101,7 +101,7 @@ static int pipe_enum_fn( struct db_record *rec, void *p) return 1; } - f = TALLOC_REALLOC_ARRAY(fenum->ctx, fenum->ctr3->array, + f = talloc_realloc(fenum->ctx, fenum->ctr3->array, struct srvsvc_NetFileInfo3, i+1); if ( !f ) { DEBUG(0,("conn_enum_fn: realloc failed for %d items\n", i+1)); @@ -179,7 +179,7 @@ static void enum_file_fn( const struct share_mode_entry *e, return; } - f = TALLOC_REALLOC_ARRAY(fenum->ctx, fenum->ctr3->array, + f = talloc_realloc(fenum->ctx, fenum->ctr3->array, struct srvsvc_NetFileInfo3, i+1); if ( !f ) { DEBUG(0,("conn_enum_fn: realloc failed for %d items\n", i+1)); @@ -816,7 +816,7 @@ static WERROR init_srv_sess_info_0(struct pipes_struct *p, for (; resume_handle < *total_entries; resume_handle++) { - ctr0->array = TALLOC_REALLOC_ARRAY(p->mem_ctx, + ctr0->array = talloc_realloc(p->mem_ctx, ctr0->array, struct srvsvc_NetSessInfo0, num_entries+1); @@ -914,7 +914,7 @@ static WERROR init_srv_sess_info_1(struct pipes_struct *p, num_files = net_count_files(pw->pw_uid, session_list[resume_handle].pid); guest = strequal( session_list[resume_handle].username, lp_guestaccount() ); - ctr1->array = TALLOC_REALLOC_ARRAY(p->mem_ctx, + ctr1->array = talloc_realloc(p->mem_ctx, ctr1->array, struct srvsvc_NetSessInfo1, num_entries+1); @@ -969,7 +969,7 @@ static WERROR init_srv_conn_info_0(struct srvsvc_NetConnCtr0 *ctr0, for (; resume_handle < *total_entries; resume_handle++) { - ctr0->array = TALLOC_REALLOC_ARRAY(talloc_tos(), + ctr0->array = talloc_realloc(talloc_tos(), ctr0->array, struct srvsvc_NetConnInfo0, num_entries+1); @@ -1023,7 +1023,7 @@ static WERROR init_srv_conn_info_1(struct srvsvc_NetConnCtr1 *ctr1, for (; resume_handle < *total_entries; resume_handle++) { - ctr1->array = TALLOC_REALLOC_ARRAY(talloc_tos(), + ctr1->array = talloc_realloc(talloc_tos(), ctr1->array, struct srvsvc_NetConnInfo1, num_entries+1); diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c index 4b065d0dd2..cda25378ee 100644 --- a/source3/rpcclient/cmd_lsarpc.c +++ b/source3/rpcclient/cmd_lsarpc.c @@ -1494,7 +1494,7 @@ static NTSTATUS cmd_lsa_add_priv(struct rpc_pipe_client *cli, } privs.count++; - set = TALLOC_REALLOC_ARRAY(mem_ctx, set, + set = talloc_realloc(mem_ctx, set, struct lsa_LUIDAttribute, privs.count); if (!set) { @@ -1592,7 +1592,7 @@ static NTSTATUS cmd_lsa_del_priv(struct rpc_pipe_client *cli, } privs.count++; - set = TALLOC_REALLOC_ARRAY(mem_ctx, set, + set = talloc_realloc(mem_ctx, set, struct lsa_LUIDAttribute, privs.count); if (!set) { diff --git a/source3/smbd/dmapi.c b/source3/smbd/dmapi.c index 28440783ab..8e80a588c5 100644 --- a/source3/smbd/dmapi.c +++ b/source3/smbd/dmapi.c @@ -96,7 +96,7 @@ static int dmapi_init_session(struct smbd_dmapi_context *ctx) do { dm_sessid_t *new_sessions; nsessions *= 2; - new_sessions = TALLOC_REALLOC_ARRAY(tmp_ctx, sessions, + new_sessions = talloc_realloc(tmp_ctx, sessions, dm_sessid_t, nsessions); if (new_sessions == NULL) { talloc_free(tmp_ctx); diff --git a/source3/smbd/ipc.c b/source3/smbd/ipc.c index 0b12179adc..aee6f58fff 100644 --- a/source3/smbd/ipc.c +++ b/source3/smbd/ipc.c @@ -298,7 +298,7 @@ static void api_dcerpc_cmd_write_done(struct tevent_req *subreq) goto send; } - state->data = TALLOC_REALLOC_ARRAY(state, state->data, uint8_t, + state->data = talloc_realloc(state, state->data, uint8_t, state->max_read); if (state->data == NULL) { reply_nterror(req, NT_STATUS_NO_MEMORY); diff --git a/source3/smbd/message.c b/source3/smbd/message.c index 34997a13dc..1877582d53 100644 --- a/source3/smbd/message.c +++ b/source3/smbd/message.c @@ -259,7 +259,7 @@ void reply_sendtxt(struct smb_request *req) len = MIN(SVAL(msg, 0), smbreq_bufrem(req, msg+2)); - tmp = TALLOC_REALLOC_ARRAY(smbd_msg_state, smbd_msg_state->msg, + tmp = talloc_realloc(smbd_msg_state, smbd_msg_state->msg, char, old_len + len); if (tmp == NULL) { diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c index aa10563aae..da66dad0d8 100644 --- a/source3/smbd/negprot.c +++ b/source3/smbd/negprot.c @@ -573,7 +573,7 @@ void reply_negprot(struct smb_request *req) char **tmp; - tmp = TALLOC_REALLOC_ARRAY(talloc_tos(), cliprotos, char *, + tmp = talloc_realloc(talloc_tos(), cliprotos, char *, num_cliprotos+1); if (tmp == NULL) { DEBUG(0, ("talloc failed\n")); diff --git a/source3/smbd/notify.c b/source3/smbd/notify.c index 24385c94a0..d711cd69be 100644 --- a/source3/smbd/notify.c +++ b/source3/smbd/notify.c @@ -424,7 +424,7 @@ static void notify_fsp(files_struct *fsp, uint32 action, const char *name) return; } - if (!(changes = TALLOC_REALLOC_ARRAY( + if (!(changes = talloc_realloc( fsp->notify, fsp->notify->changes, struct notify_change, fsp->notify->num_changes+1))) { DEBUG(0, ("talloc_realloc failed\n")); diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 7d9626387d..01200660fa 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -1894,7 +1894,7 @@ static bool smb_splice_chain(uint8_t **poutbuf, uint8_t smb_command, return false; } - outbuf = TALLOC_REALLOC_ARRAY(NULL, *poutbuf, uint8_t, new_size); + outbuf = talloc_realloc(NULL, *poutbuf, uint8_t, new_size); if (outbuf == NULL) { DEBUG(0, ("talloc failed\n")); return false; @@ -1908,7 +1908,7 @@ static bool smb_splice_chain(uint8_t **poutbuf, uint8_t smb_command, if (!find_andx_cmd_ofs(outbuf, &andx_cmd_ofs)) { DEBUG(1, ("invalid command chain\n")); - *poutbuf = TALLOC_REALLOC_ARRAY( + *poutbuf = talloc_realloc( NULL, *poutbuf, uint8_t, old_size); return false; } @@ -1996,7 +1996,7 @@ void chain_reply(struct smb_request *req) if ((req->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) { if (req->chain_outbuf == NULL) { - req->chain_outbuf = TALLOC_REALLOC_ARRAY( + req->chain_outbuf = talloc_realloc( req, req->outbuf, uint8_t, smb_len(req->outbuf) + 4); if (req->chain_outbuf == NULL) { @@ -2028,7 +2028,7 @@ void chain_reply(struct smb_request *req) * over-allocated (reply_pipe_read_and_X used to be such an * example). */ - req->chain_outbuf = TALLOC_REALLOC_ARRAY( + req->chain_outbuf = talloc_realloc( req, req->outbuf, uint8_t, smb_len(req->outbuf) + 4); if (req->chain_outbuf == NULL) { smb_panic("talloc failed"); diff --git a/source3/smbd/session.c b/source3/smbd/session.c index f3a678b205..12d4818e90 100644 --- a/source3/smbd/session.c +++ b/source3/smbd/session.c @@ -231,7 +231,7 @@ static int gather_sessioninfo(const char *key, struct sessionid *session, { struct session_list *sesslist = (struct session_list *)private_data; - sesslist->sessions = TALLOC_REALLOC_ARRAY( + sesslist->sessions = talloc_realloc( sesslist->mem_ctx, sesslist->sessions, struct sessionid, sesslist->count+1); diff --git a/source3/smbd/srvstr.c b/source3/smbd/srvstr.c index 050de599a5..c069dd4a5e 100644 --- a/source3/smbd/srvstr.c +++ b/source3/smbd/srvstr.c @@ -56,7 +56,7 @@ ssize_t message_push_string(uint8 **outbuf, const char *str, int flags) */ grow_size = (strlen(str) + 2) * 4; - if (!(tmp = TALLOC_REALLOC_ARRAY(NULL, *outbuf, uint8, + if (!(tmp = talloc_realloc(NULL, *outbuf, uint8, buf_size + grow_size))) { DEBUG(0, ("talloc failed\n")); return -1; diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index cc21b32fe7..72907c5d3a 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -129,7 +129,7 @@ NTSTATUS get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn, again: - val = TALLOC_REALLOC_ARRAY(mem_ctx, val, char, attr_size); + val = talloc_realloc(mem_ctx, val, char, attr_size); if (!val) { return NT_STATUS_NO_MEMORY; } @@ -200,7 +200,7 @@ NTSTATUS get_ea_names_from_file(TALLOC_CTX *mem_ctx, connection_struct *conn, while (ea_namelist_size <= 65536) { - ea_namelist = TALLOC_REALLOC_ARRAY( + ea_namelist = talloc_realloc( names, ea_namelist, char, ea_namelist_size); if (ea_namelist == NULL) { DEBUG(0, ("talloc failed\n")); @@ -259,7 +259,7 @@ NTSTATUS get_ea_names_from_file(TALLOC_CTX *mem_ctx, connection_struct *conn, num_names += 1; } - tmp = TALLOC_REALLOC_ARRAY(mem_ctx, names, char *, num_names); + tmp = talloc_realloc(mem_ctx, names, char *, num_names); if (tmp == NULL) { DEBUG(0, ("talloc failed\n")); TALLOC_FREE(names); diff --git a/source3/utils/net_conf.c b/source3/utils/net_conf.c index 6c61dd7206..0ae1206699 100644 --- a/source3/utils/net_conf.c +++ b/source3/utils/net_conf.c @@ -212,7 +212,7 @@ static sbcErr import_process_service(struct net_context *c, for (idx = 0; idx < service->num_params; idx ++) { if (strequal(service->param_names[idx], "include")) { - includes = TALLOC_REALLOC_ARRAY(mem_ctx, + includes = talloc_realloc(mem_ctx, includes, char *, num_includes+1); diff --git a/source3/winbindd/idmap_adex/gc_util.c b/source3/winbindd/idmap_adex/gc_util.c index e625265be0..e4bf8d59d7 100644 --- a/source3/winbindd/idmap_adex/gc_util.c +++ b/source3/winbindd/idmap_adex/gc_util.c @@ -787,11 +787,11 @@ done: msg_tmp = TALLOC_ARRAY(NULL, LDAPMessage*, 1); BAIL_ON_PTR_ERROR(msg_tmp, nt_status); } else { - ads_tmp = TALLOC_REALLOC_ARRAY(*ads_list, *ads_list, ADS_STRUCT*, + ads_tmp = talloc_realloc(*ads_list, *ads_list, ADS_STRUCT*, count+1); BAIL_ON_PTR_ERROR(ads_tmp, nt_status); - msg_tmp = TALLOC_REALLOC_ARRAY(*msg_list, *msg_list, LDAPMessage*, + msg_tmp = talloc_realloc(*msg_list, *msg_list, LDAPMessage*, count+1); BAIL_ON_PTR_ERROR(msg_tmp, nt_status); } diff --git a/source3/winbindd/wb_lookupsids.c b/source3/winbindd/wb_lookupsids.c index 05601ad192..46766dc7b1 100644 --- a/source3/winbindd/wb_lookupsids.c +++ b/source3/winbindd/wb_lookupsids.c @@ -325,7 +325,7 @@ static struct wb_lookupsids_domain *wb_lookupsids_get_domain( return NULL; } - domains = TALLOC_REALLOC_ARRAY( + domains = talloc_realloc( mem_ctx, domains, struct wb_lookupsids_domain, num_domains+1); if (domains == NULL) { return NULL; @@ -354,7 +354,7 @@ fail: /* * Realloc to the state it was in before */ - *pdomains = TALLOC_REALLOC_ARRAY( + *pdomains = talloc_realloc( mem_ctx, domains, struct wb_lookupsids_domain, num_domains); return NULL; } diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c index 50da98f62c..e1bacedaa4 100644 --- a/source3/winbindd/winbindd_cache.c +++ b/source3/winbindd/winbindd_cache.c @@ -4206,7 +4206,7 @@ static bool add_wbdomain_to_tdc_array( struct winbindd_domain *new_dom, list = TALLOC_ARRAY( NULL, struct winbindd_tdc_domain, 1 ); idx = 0; } else { - list = TALLOC_REALLOC_ARRAY( *domains, *domains, + list = talloc_realloc( *domains, *domains, struct winbindd_tdc_domain, (*num_domains)+1); idx = *num_domains; diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c index c6c93baea9..726e99787f 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -1082,7 +1082,7 @@ static bool add_one_dc_unique(TALLOC_CTX *mem_ctx, const char *domain_name, (struct sockaddr *)(void *)pss)) return False; - *dcs = TALLOC_REALLOC_ARRAY(mem_ctx, *dcs, struct dc_name_ip, (*num)+1); + *dcs = talloc_realloc(mem_ctx, *dcs, struct dc_name_ip, (*num)+1); if (*dcs == NULL) return False; @@ -1097,7 +1097,7 @@ static bool add_sockaddr_to_array(TALLOC_CTX *mem_ctx, struct sockaddr_storage *pss, uint16 port, struct sockaddr_storage **addrs, int *num) { - *addrs = TALLOC_REALLOC_ARRAY(mem_ctx, *addrs, struct sockaddr_storage, (*num)+1); + *addrs = talloc_realloc(mem_ctx, *addrs, struct sockaddr_storage, (*num)+1); if (*addrs == NULL) { *num = 0; diff --git a/source3/winbindd/winbindd_dual_srv.c b/source3/winbindd/winbindd_dual_srv.c index f42682e5f8..c2510bc84d 100644 --- a/source3/winbindd/winbindd_dual_srv.c +++ b/source3/winbindd/winbindd_dual_srv.c @@ -148,22 +148,22 @@ NTSTATUS _wbint_Sids2UnixIDs(struct pipes_struct *p, } } - ids = TALLOC_REALLOC_ARRAY(talloc_tos(), ids, + ids = talloc_realloc(talloc_tos(), ids, struct id_map, num_ids); if (ids == NULL) { goto nomem; } - id_ptrs = TALLOC_REALLOC_ARRAY(talloc_tos(), id_ptrs, + id_ptrs = talloc_realloc(talloc_tos(), id_ptrs, struct id_map *, num_ids+1); if (id_ptrs == NULL) { goto nomem; } - id_idx = TALLOC_REALLOC_ARRAY(talloc_tos(), id_idx, + id_idx = talloc_realloc(talloc_tos(), id_idx, uint32_t, num_ids); if (id_idx == NULL) { goto nomem; } - sids = TALLOC_REALLOC_ARRAY(talloc_tos(), sids, + sids = talloc_realloc(talloc_tos(), sids, struct dom_sid, num_ids); if (sids == NULL) { goto nomem; diff --git a/source3/winbindd/winbindd_rpc.c b/source3/winbindd/winbindd_rpc.c index bf438a6d5c..a4e4887703 100644 --- a/source3/winbindd/winbindd_rpc.c +++ b/source3/winbindd/winbindd_rpc.c @@ -89,7 +89,7 @@ NTSTATUS rpc_query_user_list(TALLOC_CTX *mem_ctx, num_info += num_dom_users; - info = TALLOC_REALLOC_ARRAY(mem_ctx, + info = talloc_realloc(mem_ctx, info, struct wbint_userinfo, num_info); @@ -181,7 +181,7 @@ NTSTATUS rpc_enum_dom_groups(TALLOC_CTX *mem_ctx, } } - info = TALLOC_REALLOC_ARRAY(mem_ctx, + info = talloc_realloc(mem_ctx, info, struct wb_acct_info, num_info + count); @@ -241,7 +241,7 @@ NTSTATUS rpc_enum_local_groups(TALLOC_CTX *mem_ctx, } } - info = TALLOC_REALLOC_ARRAY(mem_ctx, + info = talloc_realloc(mem_ctx, info, struct wb_acct_info, num_info + count); -- cgit