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

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
This commit is contained in:
Andrew Bartlett 2011-06-07 11:10:15 +10:00
parent 8459391e31
commit 73b377432c
51 changed files with 108 additions and 109 deletions

View File

@ -78,7 +78,7 @@ void dns_marshall_buffer(struct dns_buffer *buf, const uint8 *data,
new_size += (64 - (new_size % 64)); 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))) { new_size))) {
buf->error = ERROR_DNS_NO_MEMORY; buf->error = ERROR_DNS_NO_MEMORY;
return; return;

View File

@ -308,7 +308,7 @@ DNS_ERROR dns_add_rrec(TALLOC_CTX *mem_ctx, struct dns_rrec *rec,
{ {
struct dns_rrec **new_records; 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 *, struct dns_rrec *,
(*num_records)+1))) { (*num_records)+1))) {
return ERROR_DNS_NO_MEMORY; return ERROR_DNS_NO_MEMORY;

View File

@ -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_ZERO_SIZE(ctx, size) _talloc_zero(ctx, size, __location__)
#define TALLOC_REALLOC(ctx, ptr, count) _talloc_realloc(ctx, ptr, count, __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) #define talloc_destroy(ctx) talloc_free(ctx)
#ifndef TALLOC_FREE #ifndef TALLOC_FREE
#define TALLOC_FREE(ctx) do { talloc_free(ctx); ctx=NULL; } while(0) #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) \ #define ADD_TO_ARRAY(mem_ctx, type, elem, array, num) \
do { \ do { \
*(array) = ((mem_ctx) != NULL) ? \ *(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_REALLOC_ARRAY((*(array)), type, (*(num))+1); \
SMB_ASSERT((*(array)) != NULL); \ SMB_ASSERT((*(array)) != NULL); \
(*(array))[*(num)] = (elem); \ (*(array))[*(num)] = (elem); \

View File

@ -202,7 +202,7 @@ static size_t pull_ascii_base_talloc(TALLOC_CTX *ctx,
/* Have we got space to append the '\0' ? */ /* Have we got space to append the '\0' ? */
if (size <= dest_len) { if (size <= dest_len) {
/* No, realloc. */ /* No, realloc. */
dest = TALLOC_REALLOC_ARRAY(ctx, dest, char, dest = talloc_realloc(ctx, dest, char,
dest_len+1); dest_len+1);
if (!dest) { if (!dest) {
/* talloc fail. */ /* talloc fail. */
@ -449,7 +449,7 @@ static size_t pull_ucs2_base_talloc(TALLOC_CTX *ctx,
/* Have we got space to append the '\0' ? */ /* Have we got space to append the '\0' ? */
if (size <= dest_len) { if (size <= dest_len) {
/* No, realloc. */ /* No, realloc. */
dest = TALLOC_REALLOC_ARRAY(ctx, dest, char, dest = talloc_realloc(ctx, dest, char,
dest_len+1); dest_len+1);
if (!dest) { if (!dest) {
/* talloc fail. */ /* talloc fail. */

View File

@ -82,7 +82,7 @@ NTSTATUS ctdb_packet_fd_read(struct ctdb_packet_context *ctx)
return NT_STATUS_NO_MEMORY; 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")); DEBUG(10, ("talloc failed\n"));
return NT_STATUS_NO_MEMORY; 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; 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")); DEBUG(0, ("talloc failed\n"));
return NT_STATUS_NO_MEMORY; return NT_STATUS_NO_MEMORY;
} }

View File

@ -90,7 +90,7 @@ bool event_add_to_poll_args(struct tevent_context *ev, TALLOC_CTX *mem_ctx,
idx_len = max_fd+1; idx_len = max_fd+1;
if (talloc_array_length(state->pollfd_idx) < idx_len) { 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); state, state->pollfd_idx, int, idx_len);
if (state->pollfd_idx == NULL) { if (state->pollfd_idx == NULL) {
DEBUG(10, ("talloc_realloc failed\n")); 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) { 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); num_pollfds + num_fds + 1);
if (fds == NULL) { if (fds == NULL) {
DEBUG(10, ("talloc_realloc failed\n")); DEBUG(10, ("talloc_realloc failed\n"));

View File

@ -371,7 +371,7 @@ static NTSTATUS messaging_tdb_send(struct messaging_context *msg_ctx,
goto done; goto done;
} }
if (!(rec = TALLOC_REALLOC_ARRAY(talloc_tos(), msg_array->messages, if (!(rec = talloc_realloc(talloc_tos(), msg_array->messages,
struct messaging_rec, struct messaging_rec,
msg_array->num_messages+1))) { msg_array->num_messages+1))) {
status = NT_STATUS_NO_MEMORY; status = NT_STATUS_NO_MEMORY;

View File

@ -226,7 +226,7 @@ ssize_t message_push_blob(uint8 **outbuf, DATA_BLOB blob)
size_t newlen = smb_len(*outbuf) + 4 + blob.length; size_t newlen = smb_len(*outbuf) + 4 + blob.length;
uint8 *tmp; uint8 *tmp;
if (!(tmp = TALLOC_REALLOC_ARRAY(NULL, *outbuf, uint8, newlen))) { if (!(tmp = talloc_realloc(NULL, *outbuf, uint8, newlen))) {
DEBUG(0, ("talloc failed\n")); DEBUG(0, ("talloc failed\n"));
return -1; return -1;
} }

View File

@ -948,7 +948,7 @@ void sprintf_append(TALLOC_CTX *mem_ctx, char **string, ssize_t *len,
} }
if (increased) { if (increased) {
*string = TALLOC_REALLOC_ARRAY(mem_ctx, *string, char, *string = talloc_realloc(mem_ctx, *string, char,
*bufsize); *bufsize);
if (*string == NULL) { if (*string == NULL) {
goto error; goto error;
@ -1253,7 +1253,7 @@ char **str_list_make_v3(TALLOC_CTX *mem_ctx, const char *string,
lsize += S_LIST_ABS; lsize += S_LIST_ABS;
tmp = TALLOC_REALLOC_ARRAY(mem_ctx, list, char *, tmp = talloc_realloc(mem_ctx, list, char *,
lsize + 1); lsize + 1);
if (tmp == NULL) { if (tmp == NULL) {
DEBUG(0,("str_list_make: " DEBUG(0,("str_list_make: "

View File

@ -231,7 +231,7 @@ bool tdb_pack_append(TALLOC_CTX *mem_ctx, uint8 **buf, size_t *len,
va_end(ap); va_end(ap);
if (mem_ctx != NULL) { if (mem_ctx != NULL) {
*buf = TALLOC_REALLOC_ARRAY(mem_ctx, *buf, uint8, *buf = talloc_realloc(mem_ctx, *buf, uint8,
(*len) + len1); (*len) + len1);
} else { } else {
*buf = SMB_REALLOC_ARRAY(*buf, uint8, (*len) + len1); *buf = SMB_REALLOC_ARRAY(*buf, uint8, (*len) + len1);

View File

@ -540,7 +540,7 @@ static NTSTATUS ads_dns_lookup_srv( TALLOC_CTX *ctx,
return NT_STATUS_NO_MEMORY; return NT_STATUS_NO_MEMORY;
} }
} else { } else {
if ((tmp_ss_s = TALLOC_REALLOC_ARRAY(dcs, if ((tmp_ss_s = talloc_realloc(dcs,
dcs[i].ss_s, dcs[i].ss_s,
struct sockaddr_storage, struct sockaddr_storage,
dcs[i].num_ips+1)) dcs[i].num_ips+1))

View File

@ -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; for (curmod=0; modlist[curmod] && modlist[curmod] != (LDAPMod *) -1;
curmod++); curmod++);
if (modlist[curmod] == (LDAPMod *) -1) { 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))) curmod+ADS_MODLIST_ALLOC_SIZE+1)))
return ADS_ERROR(LDAP_NO_MEMORY); return ADS_ERROR(LDAP_NO_MEMORY);
memset(&modlist[curmod], 0, memset(&modlist[curmod], 0,
@ -2546,7 +2546,7 @@ int ads_count_replies(ADS_STRUCT *ads, void *res)
return NULL; return NULL;
} }
strings = TALLOC_REALLOC_ARRAY(mem_ctx, current_strings, char *, strings = talloc_realloc(mem_ctx, current_strings, char *,
*num_strings + num_new_strings); *num_strings + num_new_strings);
if (strings == NULL) { if (strings == NULL) {

View File

@ -901,7 +901,7 @@ bool add_gp_registry_entry_to_array(TALLOC_CTX *mem_ctx,
struct gp_registry_entry **entries, struct gp_registry_entry **entries,
size_t *num) size_t *num)
{ {
*entries = TALLOC_REALLOC_ARRAY(mem_ctx, *entries, *entries = talloc_realloc(mem_ctx, *entries,
struct gp_registry_entry, struct gp_registry_entry,
(*num)+1); (*num)+1);

View File

@ -1200,12 +1200,12 @@ static NTSTATUS ldif_realloc_maps(TALLOC_CTX *mem_ctx,
uint32_t num_entries) uint32_t num_entries)
{ {
/* Re-allocate memory for groupmap and accountmap arrays */ /* Re-allocate memory for groupmap and accountmap arrays */
l->groupmap = TALLOC_REALLOC_ARRAY(mem_ctx, l->groupmap = talloc_realloc(mem_ctx,
l->groupmap, l->groupmap,
GROUPMAP, GROUPMAP,
num_entries + l->num_alloced); num_entries + l->num_alloced);
l->accountmap = TALLOC_REALLOC_ARRAY(mem_ctx, l->accountmap = talloc_realloc(mem_ctx,
l->accountmap, l->accountmap,
ACCOUNTMAP, ACCOUNTMAP,
num_entries + l->num_alloced); num_entries + l->num_alloced);

View File

@ -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 * 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) { if (buf == NULL) {
return NULL; return NULL;
} }
@ -67,7 +67,7 @@ static uint8_t *internal_bytes_push_str(uint8_t *buf, bool ucs2,
return NULL; return NULL;
} }
buf = TALLOC_REALLOC_ARRAY(NULL, buf, uint8_t, buf = talloc_realloc(NULL, buf, uint8_t,
buflen + converted_size); buflen + converted_size);
if (buf == NULL) { if (buf == NULL) {
TALLOC_FREE(converted); TALLOC_FREE(converted);
@ -108,7 +108,7 @@ uint8_t *smb_bytes_push_bytes(uint8_t *buf, uint8_t prefix,
} }
buflen = talloc_get_size(buf); buflen = talloc_get_size(buf);
buf = TALLOC_REALLOC_ARRAY(NULL, buf, uint8_t, buf = talloc_realloc(NULL, buf, uint8_t,
buflen + 1 + num_bytes); buflen + 1 + num_bytes);
if (buf == NULL) { if (buf == NULL) {
return NULL; return NULL;
@ -1031,7 +1031,7 @@ struct tevent_req *cli_rename_send(TALLOC_CTX *mem_ctx,
return tevent_req_post(req, ev); 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); talloc_get_size(bytes)+1);
if (tevent_req_nomem(bytes, req)) { if (tevent_req_nomem(bytes, req)) {
return tevent_req_post(req, ev); 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); 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); talloc_get_size(bytes)+1);
if (tevent_req_nomem(bytes, req)) { if (tevent_req_nomem(bytes, req)) {
return tevent_req_post(req, ev); 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)) { if (tevent_req_nomem(bytes, req)) {
return tevent_req_post(req, ev); 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); talloc_get_size(bytes)+1);
if (tevent_req_nomem(bytes, req)) { if (tevent_req_nomem(bytes, req)) {
return tevent_req_post(req, ev); return tevent_req_post(req, ev);

View File

@ -387,7 +387,7 @@ static void cli_list_old_done(struct tevent_req *subreq)
dirlist_len = talloc_get_size(state->dirlist); dirlist_len = talloc_get_size(state->dirlist);
tmp = TALLOC_REALLOC_ARRAY( tmp = talloc_realloc(
state, state->dirlist, uint8_t, state, state->dirlist, uint8_t,
dirlist_len + received * DIR_STRUCT_SIZE); dirlist_len + received * DIR_STRUCT_SIZE);
if (tevent_req_nomem(tmp, req)) { 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); 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); old_num_finfo + ff_searchcount);
if (tevent_req_nomem(tmp, req)) { if (tevent_req_nomem(tmp, req)) {
return; return;
@ -711,7 +711,7 @@ static void cli_list_trans_done(struct tevent_req *subreq)
/* /*
* Shrink state->finfo to the real length we received * 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); old_num_finfo + i);
if (tevent_req_nomem(tmp, req)) { if (tevent_req_nomem(tmp, req)) {
return; return;
@ -736,7 +736,7 @@ static void cli_list_trans_done(struct tevent_req *subreq)
nlen = 2*(strlen(state->mask) + 1); 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); 12 + nlen + last_name_raw.length + 2);
if (tevent_req_nomem(param, req)) { if (tevent_req_nomem(param, req)) {
return; return;

View File

@ -998,7 +998,7 @@ static bool parse_streams_blob(TALLOC_CTX *mem_ctx, const uint8_t *rdata,
struct stream_struct *tmp; struct stream_struct *tmp;
uint8_t *tmp_buf; uint8_t *tmp_buf;
tmp = TALLOC_REALLOC_ARRAY(mem_ctx, streams, tmp = talloc_realloc(mem_ctx, streams,
struct stream_struct, struct stream_struct,
num_streams+1); num_streams+1);

View File

@ -722,7 +722,7 @@ NTSTATUS cli_smbwrite(struct cli_state *cli, uint16_t fnum, char *buf,
SIVAL(vwv+2, 0, offset); SIVAL(vwv+2, 0, offset);
SSVAL(vwv+4, 0, 0); SSVAL(vwv+4, 0, 0);
bytes = TALLOC_REALLOC_ARRAY(talloc_tos(), bytes, uint8_t, bytes = talloc_realloc(talloc_tos(), bytes, uint8_t,
size+3); size+3);
if (bytes == NULL) { if (bytes == NULL) {
return NT_STATUS_NO_MEMORY; return NT_STATUS_NO_MEMORY;

View File

@ -1317,7 +1317,7 @@ static bool name_query_validator(struct packet_struct *p, void *private_data)
return false; return false;
} }
tmp_addrs = TALLOC_REALLOC_ARRAY( tmp_addrs = talloc_realloc(
state, state->addrs, struct sockaddr_storage, state, state->addrs, struct sockaddr_storage,
state->num_addrs + nmb->answers->rdlength/6); state->num_addrs + nmb->answers->rdlength/6);
if (tmp_addrs == NULL) { if (tmp_addrs == NULL) {

View File

@ -552,7 +552,7 @@ static bool add_one_stream(TALLOC_CTX *mem_ctx, unsigned int *num_streams,
{ {
struct stream_struct *tmp; 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); (*num_streams)+1);
if (tmp == NULL) { if (tmp == NULL) {
return false; return false;

View File

@ -55,7 +55,7 @@ static NTSTATUS get_acl_blob(TALLOC_CTX *ctx,
again: again:
tmp = TALLOC_REALLOC_ARRAY(ctx, val, uint8_t, size); tmp = talloc_realloc(ctx, val, uint8_t, size);
if (tmp == NULL) { if (tmp == NULL) {
TALLOC_FREE(val); TALLOC_FREE(val);
return NT_STATUS_NO_MEMORY; return NT_STATUS_NO_MEMORY;

View File

@ -66,7 +66,7 @@ static void fileid_load_mount_entries(struct fileid_handle_data *data)
m->mnt_fsname += 5; m->mnt_fsname += 5;
} }
data->mount_entries = TALLOC_REALLOC_ARRAY(data, data->mount_entries = talloc_realloc(data,
data->mount_entries, data->mount_entries,
struct fileid_mount_entry, struct fileid_mount_entry,
data->num_mount_entries+1); data->num_mount_entries+1);

View File

@ -166,7 +166,7 @@ static bool preopen_helper_open_one(int sock_fd, char **pnamebuf,
nread += thistime; nread += thistime;
if (nread == talloc_get_size(namebuf)) { if (nread == talloc_get_size(namebuf)) {
namebuf = TALLOC_REALLOC_ARRAY( namebuf = talloc_realloc(
NULL, namebuf, char, NULL, namebuf, char,
talloc_get_size(namebuf) * 2); talloc_get_size(namebuf) * 2);
if (namebuf == NULL) { if (namebuf == NULL) {

View File

@ -716,7 +716,7 @@ static bool add_one_stream(TALLOC_CTX *mem_ctx, unsigned int *num_streams,
{ {
struct stream_struct *tmp; 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); (*num_streams)+1);
if (tmp == NULL) { if (tmp == NULL) {
return false; return false;

View File

@ -731,7 +731,7 @@ static bool add_one_stream(TALLOC_CTX *mem_ctx, unsigned int *num_streams,
{ {
struct stream_struct *tmp; 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); (*num_streams)+1);
if (tmp == NULL) { if (tmp == NULL) {
return false; return false;
@ -880,7 +880,7 @@ static ssize_t streams_xattr_pwrite(vfs_handle_struct *handle,
if ((offset + n) > ea.value.length-1) { if ((offset + n) > ea.value.length-1) {
uint8 *tmp; uint8 *tmp;
tmp = TALLOC_REALLOC_ARRAY(talloc_tos(), ea.value.data, uint8, tmp = talloc_realloc(talloc_tos(), ea.value.data, uint8,
offset + n + 1); offset + n + 1);
if (tmp == NULL) { if (tmp == NULL) {
@ -986,7 +986,7 @@ static int streams_xattr_ftruncate(struct vfs_handle_struct *handle,
return -1; return -1;
} }
tmp = TALLOC_REALLOC_ARRAY(talloc_tos(), ea.value.data, uint8, tmp = talloc_realloc(talloc_tos(), ea.value.data, uint8,
offset + 1); offset + 1);
if (tmp == NULL) { if (tmp == NULL) {

View File

@ -299,12 +299,12 @@ static int xattr_tdb_setattr(struct db_context *db_ctx,
return -1; return -1;
} }
tmp = TALLOC_REALLOC_ARRAY( tmp = talloc_realloc(
attribs, attribs->eas, struct xattr_EA, attribs, attribs->eas, struct xattr_EA,
attribs->num_eas+ 1); attribs->num_eas+ 1);
if (tmp == NULL) { if (tmp == NULL) {
DEBUG(0, ("TALLOC_REALLOC_ARRAY failed\n")); DEBUG(0, ("talloc_realloc failed\n"));
TALLOC_FREE(rec); TALLOC_FREE(rec);
errno = ENOMEM; errno = ENOMEM;
return -1; return -1;

View File

@ -1885,7 +1885,7 @@ bool listen_for_packets(bool run_election)
* create_listen_pollfds. * 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) { if (fds == NULL) {
return true; return true;
} }
@ -1894,7 +1894,7 @@ bool listen_for_packets(bool run_election)
#ifndef SYNC_DNS #ifndef SYNC_DNS
dns_fd = asyncdns_fd(); dns_fd = asyncdns_fd();
if (dns_fd != -1) { 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) { if (fds == NULL) {
return true; return true;
} }

View File

@ -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); const char *, i+2);
SMB_ASSERT((*attr_list) != NULL); SMB_ASSERT((*attr_list) != NULL);
(*attr_list)[i] = talloc_strdup((*attr_list), new_attr); (*attr_list)[i] = talloc_strdup((*attr_list), new_attr);

View File

@ -211,7 +211,7 @@ WERROR regsubkey_ctr_addkey( struct regsubkey_ctr *ctr, const char *keyname )
return WERR_OK; return WERR_OK;
} }
if (!(newkeys = TALLOC_REALLOC_ARRAY(ctr, ctr->subkeys, char *, if (!(newkeys = talloc_realloc(ctr, ctr->subkeys, char *,
ctr->num_subkeys+1))) { ctr->num_subkeys+1))) {
return WERR_NOMEM; 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 ) { if ( ctr->num_values == 0 ) {
ctr->values = TALLOC_P( ctr, struct regval_blob *); ctr->values = TALLOC_P( ctr, struct regval_blob *);
} else { } else {
ctr->values = TALLOC_REALLOC_ARRAY(ctr, ctr->values, ctr->values = talloc_realloc(ctr, ctr->values,
struct regval_blob *, struct regval_blob *,
ctr->num_values+1); ctr->num_values+1);
} }

View File

@ -376,7 +376,7 @@ static bool _reg_perfcount_add_object(struct PERF_DATA_BLOCK *block,
bool success = True; bool success = True;
struct PERF_OBJECT_TYPE *obj; 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, block->objects,
struct PERF_OBJECT_TYPE, struct PERF_OBJECT_TYPE,
block->NumObjectTypes+1); block->NumObjectTypes+1);
@ -547,7 +547,7 @@ static bool _reg_perfcount_get_counter_info(struct PERF_DATA_BLOCK *block,
SAFE_FREE(data.dptr); SAFE_FREE(data.dptr);
obj->counter_data.ByteLength += dsize + padding; 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, obj->counter_data.data,
uint8, uint8,
obj->counter_data.ByteLength - sizeof(uint32)); obj->counter_data.ByteLength - sizeof(uint32));
@ -635,7 +635,7 @@ static bool _reg_perfcount_add_counter(struct PERF_DATA_BLOCK *block,
parent, num)); parent, num));
return False; 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, obj->counters,
struct PERF_COUNTER_DEFINITION, struct PERF_COUNTER_DEFINITION,
obj->NumCounters+1); obj->NumCounters+1);
@ -687,7 +687,7 @@ static bool _reg_perfcount_get_instance_info(struct PERF_INSTANCE_DEFINITION *in
return False; return False;
} }
inst->counter_data.ByteLength = data.dsize + sizeof(inst->counter_data.ByteLength); 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, inst->counter_data.data,
uint8, uint8,
data.dsize); data.dsize);
@ -719,7 +719,7 @@ static bool _reg_perfcount_get_instance_info(struct PERF_INSTANCE_DEFINITION *in
SAFE_FREE(data.dptr); SAFE_FREE(data.dptr);
return False; return False;
} }
inst->data = TALLOC_REALLOC_ARRAY(mem_ctx, inst->data = talloc_realloc(mem_ctx,
inst->data, inst->data,
uint8, uint8,
inst->NameLength); inst->NameLength);
@ -741,7 +741,7 @@ static bool _reg_perfcount_get_instance_info(struct PERF_INSTANCE_DEFINITION *in
if((pad = (inst->ByteLength % 8))) if((pad = (inst->ByteLength % 8)))
{ {
pad = 8 - pad; pad = 8 - pad;
inst->data = TALLOC_REALLOC_ARRAY(mem_ctx, inst->data = talloc_realloc(mem_ctx,
inst->data, inst->data,
uint8, uint8,
inst->NameLength + pad); inst->NameLength + pad);
@ -763,7 +763,7 @@ static bool _reg_perfcount_add_instance(struct PERF_OBJECT_TYPE *obj,
struct PERF_INSTANCE_DEFINITION *inst; struct PERF_INSTANCE_DEFINITION *inst;
if(obj->instances == NULL) { if(obj->instances == NULL) {
obj->instances = TALLOC_REALLOC_ARRAY(mem_ctx, obj->instances = talloc_realloc(mem_ctx,
obj->instances, obj->instances,
struct PERF_INSTANCE_DEFINITION, struct PERF_INSTANCE_DEFINITION,
obj->NumInstances); 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_data = &(instance->counter_data);
counter = &(object[obj].counters[object[obj].NumCounters - 1]); counter = &(object[obj].counters[object[obj].NumCounters - 1]);
counter_data->ByteLength = counter->CounterOffset + counter->CounterSize + sizeof(counter_data->ByteLength); counter_data->ByteLength = counter->CounterOffset + counter->CounterSize + sizeof(counter_data->ByteLength);
temp = TALLOC_REALLOC_ARRAY(mem_ctx, temp = talloc_realloc(mem_ctx,
temp, temp,
char, char,
counter_data->ByteLength- sizeof(counter_data->ByteLength)); 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; pad = 8 - pad;
} }
counter_data->data = TALLOC_REALLOC_ARRAY(mem_ctx, counter_data->data = talloc_realloc(mem_ctx,
counter_data->data, counter_data->data,
uint8, uint8,
counter_data->ByteLength - sizeof(counter_data->ByteLength) + pad); 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))) if((pad = (object[obj].counter_data.ByteLength % 8)))
{ {
pad = 8 - pad; 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, object[obj].counter_data.data,
uint8, uint8,
object[obj].counter_data.ByteLength + pad); object[obj].counter_data.ByteLength + pad);

View File

@ -615,7 +615,7 @@ NTSTATUS dcerpc_winreg_add_multi_sz(TALLOC_CTX *mem_ctx,
/* count the elements */ /* count the elements */
for (p = a, i = 0; p && *p; p++, i++); 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) { if (p == NULL) {
*pwerr = WERR_NOMEM; *pwerr = WERR_NOMEM;
return NT_STATUS_OK; return NT_STATUS_OK;

View File

@ -122,7 +122,7 @@ static int init_lsa_ref_domain_list(TALLOC_CTX *mem_ctx,
ref->count = num + 1; ref->count = num + 1;
ref->max_size = LSA_REF_DOMAIN_LIST_MULTIPLIER; 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); struct lsa_DomainInfo, ref->count);
if (!ref->domains) { if (!ref->domains) {
return -1; return -1;

View File

@ -1094,7 +1094,7 @@ static int notify_msg_ctr_addmsg( SPOOLSS_NOTIFY_MSG_CTR *ctr, SPOOLSS_NOTIFY_MS
if ( i == ctr->num_groups ) { if ( i == ctr->num_groups ) {
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")); DEBUG(0,("notify_msg_ctr_addmsg: talloc_realloc() failed!\n"));
return 0; return 0;
} }
@ -1112,7 +1112,7 @@ static int notify_msg_ctr_addmsg( SPOOLSS_NOTIFY_MSG_CTR *ctr, SPOOLSS_NOTIFY_MS
msg_grp->num_msgs++; 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)); DEBUG(0,("notify_msg_ctr_addmsg: talloc_realloc() failed for new message [%d]!\n", msg_grp->num_msgs));
return 0; return 0;
} }
@ -3438,7 +3438,7 @@ static bool construct_notify_printer_info(struct messaging_context *msg_ctx,
if (!search_notify(type, field, &j) ) if (!search_notify(type, field, &j) )
continue; continue;
info->notifies = TALLOC_REALLOC_ARRAY(info, info->notifies, info->notifies = talloc_realloc(info, info->notifies,
struct spoolss_Notify, struct spoolss_Notify,
info->count + 1); info->count + 1);
if (info->notifies == NULL) { 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) ) if (!search_notify(type, field, &j) )
continue; continue;
info->notifies = TALLOC_REALLOC_ARRAY(info, info->notifies, info->notifies = talloc_realloc(info, info->notifies,
struct spoolss_Notify, struct spoolss_Notify,
info->count + 1); info->count + 1);
if (info->notifies == NULL) { if (info->notifies == NULL) {
@ -4307,7 +4307,7 @@ static WERROR enum_all_printers_info_level(TALLOC_CTX *mem_ctx,
goto out; goto out;
} }
info = TALLOC_REALLOC_ARRAY(mem_ctx, info, info = talloc_realloc(mem_ctx, info,
union spoolss_PrinterInfo, union spoolss_PrinterInfo,
count + 1); count + 1);
if (!info) { if (!info) {
@ -5347,7 +5347,7 @@ static WERROR spoolss_DriverFileInfo_from_driver(TALLOC_CTX *mem_ctx,
*count_p = 0; *count_p = 0;
if (strlen(driver->driver_path)) { if (strlen(driver->driver_path)) {
info = TALLOC_REALLOC_ARRAY(mem_ctx, info, info = talloc_realloc(mem_ctx, info,
struct spoolss_DriverFileInfo, struct spoolss_DriverFileInfo,
count + 1); count + 1);
W_ERROR_HAVE_NO_MEMORY(info); 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)) { if (strlen(driver->config_file)) {
info = TALLOC_REALLOC_ARRAY(mem_ctx, info, info = talloc_realloc(mem_ctx, info,
struct spoolss_DriverFileInfo, struct spoolss_DriverFileInfo,
count + 1); count + 1);
W_ERROR_HAVE_NO_MEMORY(info); 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)) { if (strlen(driver->data_file)) {
info = TALLOC_REALLOC_ARRAY(mem_ctx, info, info = talloc_realloc(mem_ctx, info,
struct spoolss_DriverFileInfo, struct spoolss_DriverFileInfo,
count + 1); count + 1);
W_ERROR_HAVE_NO_MEMORY(info); 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)) { if (strlen(driver->help_file)) {
info = TALLOC_REALLOC_ARRAY(mem_ctx, info, info = talloc_realloc(mem_ctx, info,
struct spoolss_DriverFileInfo, struct spoolss_DriverFileInfo,
count + 1); count + 1);
W_ERROR_HAVE_NO_MEMORY(info); 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++) { 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, struct spoolss_DriverFileInfo,
count + 1); count + 1);
W_ERROR_HAVE_NO_MEMORY(info); W_ERROR_HAVE_NO_MEMORY(info);
@ -7292,7 +7292,7 @@ static WERROR enumprinterdrivers_level_by_architecture(TALLOC_CTX *mem_ctx,
num_drivers, architecture, version)); num_drivers, architecture, version));
if (num_drivers != 0) { if (num_drivers != 0) {
info = TALLOC_REALLOC_ARRAY(mem_ctx, info, info = talloc_realloc(mem_ctx, info,
union spoolss_DriverInfo, union spoolss_DriverInfo,
count + num_drivers); count + num_drivers);
if (!info) { if (!info) {

View File

@ -101,7 +101,7 @@ static int pipe_enum_fn( struct db_record *rec, void *p)
return 1; return 1;
} }
f = TALLOC_REALLOC_ARRAY(fenum->ctx, fenum->ctr3->array, f = talloc_realloc(fenum->ctx, fenum->ctr3->array,
struct srvsvc_NetFileInfo3, i+1); struct srvsvc_NetFileInfo3, i+1);
if ( !f ) { if ( !f ) {
DEBUG(0,("conn_enum_fn: realloc failed for %d items\n", i+1)); 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; return;
} }
f = TALLOC_REALLOC_ARRAY(fenum->ctx, fenum->ctr3->array, f = talloc_realloc(fenum->ctx, fenum->ctr3->array,
struct srvsvc_NetFileInfo3, i+1); struct srvsvc_NetFileInfo3, i+1);
if ( !f ) { if ( !f ) {
DEBUG(0,("conn_enum_fn: realloc failed for %d items\n", i+1)); 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++) { for (; resume_handle < *total_entries; resume_handle++) {
ctr0->array = TALLOC_REALLOC_ARRAY(p->mem_ctx, ctr0->array = talloc_realloc(p->mem_ctx,
ctr0->array, ctr0->array,
struct srvsvc_NetSessInfo0, struct srvsvc_NetSessInfo0,
num_entries+1); 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); num_files = net_count_files(pw->pw_uid, session_list[resume_handle].pid);
guest = strequal( session_list[resume_handle].username, lp_guestaccount() ); 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, ctr1->array,
struct srvsvc_NetSessInfo1, struct srvsvc_NetSessInfo1,
num_entries+1); 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++) { for (; resume_handle < *total_entries; resume_handle++) {
ctr0->array = TALLOC_REALLOC_ARRAY(talloc_tos(), ctr0->array = talloc_realloc(talloc_tos(),
ctr0->array, ctr0->array,
struct srvsvc_NetConnInfo0, struct srvsvc_NetConnInfo0,
num_entries+1); 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++) { for (; resume_handle < *total_entries; resume_handle++) {
ctr1->array = TALLOC_REALLOC_ARRAY(talloc_tos(), ctr1->array = talloc_realloc(talloc_tos(),
ctr1->array, ctr1->array,
struct srvsvc_NetConnInfo1, struct srvsvc_NetConnInfo1,
num_entries+1); num_entries+1);

View File

@ -1494,7 +1494,7 @@ static NTSTATUS cmd_lsa_add_priv(struct rpc_pipe_client *cli,
} }
privs.count++; privs.count++;
set = TALLOC_REALLOC_ARRAY(mem_ctx, set, set = talloc_realloc(mem_ctx, set,
struct lsa_LUIDAttribute, struct lsa_LUIDAttribute,
privs.count); privs.count);
if (!set) { if (!set) {
@ -1592,7 +1592,7 @@ static NTSTATUS cmd_lsa_del_priv(struct rpc_pipe_client *cli,
} }
privs.count++; privs.count++;
set = TALLOC_REALLOC_ARRAY(mem_ctx, set, set = talloc_realloc(mem_ctx, set,
struct lsa_LUIDAttribute, struct lsa_LUIDAttribute,
privs.count); privs.count);
if (!set) { if (!set) {

View File

@ -96,7 +96,7 @@ static int dmapi_init_session(struct smbd_dmapi_context *ctx)
do { do {
dm_sessid_t *new_sessions; dm_sessid_t *new_sessions;
nsessions *= 2; nsessions *= 2;
new_sessions = TALLOC_REALLOC_ARRAY(tmp_ctx, sessions, new_sessions = talloc_realloc(tmp_ctx, sessions,
dm_sessid_t, nsessions); dm_sessid_t, nsessions);
if (new_sessions == NULL) { if (new_sessions == NULL) {
talloc_free(tmp_ctx); talloc_free(tmp_ctx);

View File

@ -298,7 +298,7 @@ static void api_dcerpc_cmd_write_done(struct tevent_req *subreq)
goto send; goto send;
} }
state->data = TALLOC_REALLOC_ARRAY(state, state->data, uint8_t, state->data = talloc_realloc(state, state->data, uint8_t,
state->max_read); state->max_read);
if (state->data == NULL) { if (state->data == NULL) {
reply_nterror(req, NT_STATUS_NO_MEMORY); reply_nterror(req, NT_STATUS_NO_MEMORY);

View File

@ -259,7 +259,7 @@ void reply_sendtxt(struct smb_request *req)
len = MIN(SVAL(msg, 0), smbreq_bufrem(req, msg+2)); 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); char, old_len + len);
if (tmp == NULL) { if (tmp == NULL) {

View File

@ -573,7 +573,7 @@ void reply_negprot(struct smb_request *req)
char **tmp; char **tmp;
tmp = TALLOC_REALLOC_ARRAY(talloc_tos(), cliprotos, char *, tmp = talloc_realloc(talloc_tos(), cliprotos, char *,
num_cliprotos+1); num_cliprotos+1);
if (tmp == NULL) { if (tmp == NULL) {
DEBUG(0, ("talloc failed\n")); DEBUG(0, ("talloc failed\n"));

View File

@ -424,7 +424,7 @@ static void notify_fsp(files_struct *fsp, uint32 action, const char *name)
return; return;
} }
if (!(changes = TALLOC_REALLOC_ARRAY( if (!(changes = talloc_realloc(
fsp->notify, fsp->notify->changes, fsp->notify, fsp->notify->changes,
struct notify_change, fsp->notify->num_changes+1))) { struct notify_change, fsp->notify->num_changes+1))) {
DEBUG(0, ("talloc_realloc failed\n")); DEBUG(0, ("talloc_realloc failed\n"));

View File

@ -1894,7 +1894,7 @@ static bool smb_splice_chain(uint8_t **poutbuf, uint8_t smb_command,
return false; return false;
} }
outbuf = TALLOC_REALLOC_ARRAY(NULL, *poutbuf, uint8_t, new_size); outbuf = talloc_realloc(NULL, *poutbuf, uint8_t, new_size);
if (outbuf == NULL) { if (outbuf == NULL) {
DEBUG(0, ("talloc failed\n")); DEBUG(0, ("talloc failed\n"));
return false; 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)) { if (!find_andx_cmd_ofs(outbuf, &andx_cmd_ofs)) {
DEBUG(1, ("invalid command chain\n")); DEBUG(1, ("invalid command chain\n"));
*poutbuf = TALLOC_REALLOC_ARRAY( *poutbuf = talloc_realloc(
NULL, *poutbuf, uint8_t, old_size); NULL, *poutbuf, uint8_t, old_size);
return false; 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->wct < 2) || (CVAL(req->outbuf, smb_wct) < 2)) {
if (req->chain_outbuf == NULL) { if (req->chain_outbuf == NULL) {
req->chain_outbuf = TALLOC_REALLOC_ARRAY( req->chain_outbuf = talloc_realloc(
req, req->outbuf, uint8_t, req, req->outbuf, uint8_t,
smb_len(req->outbuf) + 4); smb_len(req->outbuf) + 4);
if (req->chain_outbuf == NULL) { 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 * over-allocated (reply_pipe_read_and_X used to be such an
* example). * example).
*/ */
req->chain_outbuf = TALLOC_REALLOC_ARRAY( req->chain_outbuf = talloc_realloc(
req, req->outbuf, uint8_t, smb_len(req->outbuf) + 4); req, req->outbuf, uint8_t, smb_len(req->outbuf) + 4);
if (req->chain_outbuf == NULL) { if (req->chain_outbuf == NULL) {
smb_panic("talloc failed"); smb_panic("talloc failed");

View File

@ -231,7 +231,7 @@ static int gather_sessioninfo(const char *key, struct sessionid *session,
{ {
struct session_list *sesslist = (struct session_list *)private_data; 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->mem_ctx, sesslist->sessions, struct sessionid,
sesslist->count+1); sesslist->count+1);

View File

@ -56,7 +56,7 @@ ssize_t message_push_string(uint8 **outbuf, const char *str, int flags)
*/ */
grow_size = (strlen(str) + 2) * 4; 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))) { buf_size + grow_size))) {
DEBUG(0, ("talloc failed\n")); DEBUG(0, ("talloc failed\n"));
return -1; return -1;

View File

@ -129,7 +129,7 @@ NTSTATUS get_ea_value(TALLOC_CTX *mem_ctx, connection_struct *conn,
again: again:
val = TALLOC_REALLOC_ARRAY(mem_ctx, val, char, attr_size); val = talloc_realloc(mem_ctx, val, char, attr_size);
if (!val) { if (!val) {
return NT_STATUS_NO_MEMORY; 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) { while (ea_namelist_size <= 65536) {
ea_namelist = TALLOC_REALLOC_ARRAY( ea_namelist = talloc_realloc(
names, ea_namelist, char, ea_namelist_size); names, ea_namelist, char, ea_namelist_size);
if (ea_namelist == NULL) { if (ea_namelist == NULL) {
DEBUG(0, ("talloc failed\n")); 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; 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) { if (tmp == NULL) {
DEBUG(0, ("talloc failed\n")); DEBUG(0, ("talloc failed\n"));
TALLOC_FREE(names); TALLOC_FREE(names);

View File

@ -212,7 +212,7 @@ static sbcErr import_process_service(struct net_context *c,
for (idx = 0; idx < service->num_params; idx ++) { for (idx = 0; idx < service->num_params; idx ++) {
if (strequal(service->param_names[idx], "include")) { if (strequal(service->param_names[idx], "include")) {
includes = TALLOC_REALLOC_ARRAY(mem_ctx, includes = talloc_realloc(mem_ctx,
includes, includes,
char *, char *,
num_includes+1); num_includes+1);

View File

@ -787,11 +787,11 @@ done:
msg_tmp = TALLOC_ARRAY(NULL, LDAPMessage*, 1); msg_tmp = TALLOC_ARRAY(NULL, LDAPMessage*, 1);
BAIL_ON_PTR_ERROR(msg_tmp, nt_status); BAIL_ON_PTR_ERROR(msg_tmp, nt_status);
} else { } else {
ads_tmp = TALLOC_REALLOC_ARRAY(*ads_list, *ads_list, ADS_STRUCT*, ads_tmp = talloc_realloc(*ads_list, *ads_list, ADS_STRUCT*,
count+1); count+1);
BAIL_ON_PTR_ERROR(ads_tmp, nt_status); 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); count+1);
BAIL_ON_PTR_ERROR(msg_tmp, nt_status); BAIL_ON_PTR_ERROR(msg_tmp, nt_status);
} }

View File

@ -325,7 +325,7 @@ static struct wb_lookupsids_domain *wb_lookupsids_get_domain(
return NULL; return NULL;
} }
domains = TALLOC_REALLOC_ARRAY( domains = talloc_realloc(
mem_ctx, domains, struct wb_lookupsids_domain, num_domains+1); mem_ctx, domains, struct wb_lookupsids_domain, num_domains+1);
if (domains == NULL) { if (domains == NULL) {
return NULL; return NULL;
@ -354,7 +354,7 @@ fail:
/* /*
* Realloc to the state it was in before * Realloc to the state it was in before
*/ */
*pdomains = TALLOC_REALLOC_ARRAY( *pdomains = talloc_realloc(
mem_ctx, domains, struct wb_lookupsids_domain, num_domains); mem_ctx, domains, struct wb_lookupsids_domain, num_domains);
return NULL; return NULL;
} }

View File

@ -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 ); list = TALLOC_ARRAY( NULL, struct winbindd_tdc_domain, 1 );
idx = 0; idx = 0;
} else { } else {
list = TALLOC_REALLOC_ARRAY( *domains, *domains, list = talloc_realloc( *domains, *domains,
struct winbindd_tdc_domain, struct winbindd_tdc_domain,
(*num_domains)+1); (*num_domains)+1);
idx = *num_domains; idx = *num_domains;

View File

@ -1082,7 +1082,7 @@ static bool add_one_dc_unique(TALLOC_CTX *mem_ctx, const char *domain_name,
(struct sockaddr *)(void *)pss)) (struct sockaddr *)(void *)pss))
return False; 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) if (*dcs == NULL)
return False; 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 *pss, uint16 port,
struct sockaddr_storage **addrs, int *num) 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) { if (*addrs == NULL) {
*num = 0; *num = 0;

View File

@ -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); struct id_map, num_ids);
if (ids == NULL) { if (ids == NULL) {
goto nomem; 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); struct id_map *, num_ids+1);
if (id_ptrs == NULL) { if (id_ptrs == NULL) {
goto nomem; goto nomem;
} }
id_idx = TALLOC_REALLOC_ARRAY(talloc_tos(), id_idx, id_idx = talloc_realloc(talloc_tos(), id_idx,
uint32_t, num_ids); uint32_t, num_ids);
if (id_idx == NULL) { if (id_idx == NULL) {
goto nomem; goto nomem;
} }
sids = TALLOC_REALLOC_ARRAY(talloc_tos(), sids, sids = talloc_realloc(talloc_tos(), sids,
struct dom_sid, num_ids); struct dom_sid, num_ids);
if (sids == NULL) { if (sids == NULL) {
goto nomem; goto nomem;

View File

@ -89,7 +89,7 @@ NTSTATUS rpc_query_user_list(TALLOC_CTX *mem_ctx,
num_info += num_dom_users; num_info += num_dom_users;
info = TALLOC_REALLOC_ARRAY(mem_ctx, info = talloc_realloc(mem_ctx,
info, info,
struct wbint_userinfo, struct wbint_userinfo,
num_info); 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, info,
struct wb_acct_info, struct wb_acct_info,
num_info + count); 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, info,
struct wb_acct_info, struct wb_acct_info,
num_info + count); num_info + count);