}
if (group_ret > 0 &&
- !(groupSIDs = talloc_array_p(*server_info, struct dom_sid *, group_ret))) {
+ !(groupSIDs = talloc_array(*server_info, struct dom_sid *, group_ret))) {
talloc_free(*server_info);
return NT_STATUS_NO_MEMORY;
}
struct ldb_wrap *sam_ctx = ctx;
struct ldb_val val;
int i;
- val.data = talloc_array(mem_ctx, 16, count, __location__);
+ val.data = talloc_array_size(mem_ctx, 16, count);
val.length = count*16;
if (!val.data) {
return -1;
/* Lists, trees, caching, database... */
#include "version.h"
#include "xfile.h"
+#define TALLOC_DEPRECATED 1
#include "lib/talloc/talloc.h"
#include "nt_status.h"
#include "structs.h"
outbuf = NULL;
convert:
destlen = 2 + (destlen*3);
- ob = (char *)talloc_realloc(ctx, outbuf, destlen);
+ ob = talloc_realloc(ctx, outbuf, char, destlen);
if (!ob) {
DEBUG(0, ("convert_string_talloc: realloc failed!\n"));
talloc_free(outbuf);
return ret;
case REG_BINARY:
- ret = talloc_array(mem_ctx, 3, v->data_len+1, "REG_BINARY");
+ ret = talloc_array_size(mem_ctx, 3, v->data_len+1);
asciip = ret;
for (i=0; i<v->data_len; i++) {
int str_rem = v->data_len * 3 - (asciip - ret);
}
len = vsnprintf(NULL, 0, fmt, ap2);
- s = talloc_realloc(NULL, s, s_len + len+1);
+ s = talloc_realloc(NULL, s, char, s_len + len+1);
if (!s) return NULL;
VA_COPY(ap2, ap);
/*
alloc an array, checking for integer overflow in the array size
*/
-void *talloc_array(const void *ctx, size_t el_size, unsigned count, const char *name)
+void *_talloc_array(const void *ctx, size_t el_size, unsigned count, const char *name)
{
if (count >= MAX_TALLOC_SIZE/el_size) {
return NULL;
/*
alloc an zero array, checking for integer overflow in the array size
*/
-void *talloc_zero_array(const void *ctx, size_t el_size, unsigned count, const char *name)
+void *_talloc_zero_array(const void *ctx, size_t el_size, unsigned count, const char *name)
{
if (count >= MAX_TALLOC_SIZE/el_size) {
return NULL;
/*
realloc an array, checking for integer overflow in the array size
*/
-void *talloc_realloc_array(const void *ctx, void *ptr, size_t el_size, unsigned count, const char *name)
+void *_talloc_realloc_array(const void *ctx, void *ptr, size_t el_size, unsigned count, const char *name)
{
if (count >= MAX_TALLOC_SIZE/el_size) {
return NULL;
}
- ptr = talloc_realloc(ctx, ptr, el_size * count);
- if (ptr) {
- talloc_set_name_const(ptr, name);
- }
- return ptr;
+ return _talloc_realloc(ctx, ptr, el_size * count, name);
}
/*
#define __LINESTR__ _STRING_LINE2_(__LINE__)
#define __location__ __FILE__ ":" __LINESTR__
+#ifndef TALLOC_DEPRECATED
+#define TALLOC_DEPRECATED 0
+#endif
+
/* useful macros for creating type checked pointers */
#define talloc(ctx, type) (type *)talloc_named_const(ctx, sizeof(type), #type)
-#define talloc_p(ctx, type) talloc(ctx, type)
#define talloc_size(ctx, size) talloc_named_const(ctx, size, __location__)
-#define talloc_zero(ctx, size) _talloc_zero(ctx, size, __location__)
-#define talloc_realloc(ctx, ptr, size) _talloc_realloc(ctx, ptr, size, __location__)
+
#define talloc_new(ctx) talloc_named_const(ctx, 0, "talloc_new: " __location__)
-#define talloc_zero_p(ctx, type) (type *)_talloc_zero(ctx, sizeof(type), #type)
-#define talloc_zero_array_p(ctx, type, count) (type *)talloc_zero_array(ctx, sizeof(type), count, __location__)
-#define talloc_array_p(ctx, type, count) (type *)talloc_array(ctx, sizeof(type), count, __location__)
-#define talloc_realloc_p(ctx, p, type, count) (type *)talloc_realloc_array(ctx, p, sizeof(type), count, __location__)
+
+#define talloc_zero(ctx, type) (type *)_talloc_zero(ctx, sizeof(type), #type)
+#define talloc_zero_size(ctx, size) _talloc_zero(ctx, size, __location__)
+
+#define talloc_zero_array(ctx, type, count) (type *)_talloc_zero_array(ctx, sizeof(type), count, __location__)
+#define talloc_array(ctx, type, count) (type *)_talloc_array(ctx, sizeof(type), count, __location__)
+#define talloc_array_size(ctx, size, count) _talloc_array(ctx, size, count, __location__)
+
+#define talloc_realloc(ctx, p, type, count) (type *)_talloc_realloc_array(ctx, p, sizeof(type), count, __location__)
+#define talloc_realloc_size(ctx, ptr, size) _talloc_realloc(ctx, ptr, size, __location__)
+
#define talloc_memdup(t, p, size) _talloc_memdup(t, p, size, __location__)
#define talloc_destroy(ctx) talloc_free(ctx)
#define data_blob(ptr, size) data_blob_named(ptr, size, "DATA_BLOB: "__location__)
#define data_blob_talloc(ctx, ptr, size) data_blob_talloc_named(ctx, ptr, size, "DATA_BLOB: "__location__)
+
+#if TALLOC_DEPRECATED
+#define talloc_zero_p(ctx, type) talloc_zero(ctx, type)
+#define talloc_p(ctx, type) talloc(ctx, type)
+#define talloc_array_p(ctx, type, count) talloc_array(ctx, type, count)
+#define talloc_realloc_p(ctx, p, type, count) talloc_realloc(ctx, p, type, count)
+#endif
+
#ifndef PRINTF_ATTRIBUTE
#define PRINTF_ATTRIBUTE(a1, a2)
#endif
char *talloc_asprintf(const void *t, const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
char *talloc_asprintf_append(char *s,
const char *fmt, ...) PRINTF_ATTRIBUTE(2,3);
-void *talloc_array(const void *ctx, size_t el_size, unsigned count, const char *name);
-void *talloc_zero_array(const void *ctx, size_t el_size, unsigned count, const char *name);
-void *talloc_realloc_array(const void *ctx, void *ptr, size_t el_size, unsigned count, const char *name);
+void *_talloc_array(const void *ctx, size_t el_size, unsigned count, const char *name);
+void *_talloc_zero_array(const void *ctx, size_t el_size, unsigned count, const char *name);
+void *_talloc_realloc_array(const void *ctx, void *ptr, size_t el_size, unsigned count, const char *name);
void *talloc_realloc_fn(const void *context, void *ptr, size_t size);
void *talloc_autofree_context(void);
September 2004
The most current version of this document is available at
- http://samba.org/ftp/unpacked/samba4/talloc_guide.txt
+ http://samba.org/ftp/unpacked/samba4/source/lib/talloc/talloc_guide.txt
If you are used to talloc from Samba3 then please read this carefully,
as talloc has changed a lot.
returned from talloc() is itself a valid talloc context. This means
you can do this:
- struct foo *X = talloc_p(mem_ctx, struct foo);
+ struct foo *X = talloc(mem_ctx, struct foo);
X->name = talloc_strdup(X, "foo");
and the pointer X->name would be a "child" of the talloc context "X"
If you find this confusing, then I suggest you run the LOCAL-TALLOC
smbtorture test to watch talloc in action. You may also like to add
-your own tests to source/torture/local/talloc.c to clarify how some
+your own tests to source/lib/talloc/testsuite.c to clarify how some
particular situation is handled.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_realloc(const void *context, void *ptr, size_t size);
+(type *)talloc_realloc(const void *context, void *ptr, type, count);
-The talloc_realloc() function changes the size of a talloc
+The talloc_realloc() macro changes the size of a talloc
pointer. It has the following equivalences:
- talloc_realloc(context, NULL, size) ==> talloc_size(context, size);
- talloc_realloc(context, ptr, 0) ==> talloc_free(ptr);
+ talloc_realloc(context, NULL, type, 1) ==> talloc(context, type);
+ talloc_realloc(context, ptr, type, 0) ==> talloc_free(ptr);
The "context" argument is only used if "ptr" is not NULL, otherwise it
is ignored.
more than one parent (see talloc_reference()).
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+void *talloc_realloc_size(const void *context, void *ptr, size_t size);
+
+the talloc_realloc_size() function is useful when the type is not
+known so the typesafe talloc_realloc() cannot be used.
+
+
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
void *talloc_steal(const void *new_ctx, const void *ptr);
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_zero(const void *ctx, size_t size);
+(type *)talloc_zero(const void *ctx, type);
-The talloc_zero() function is equivalent to:
+The talloc_zero() macro is equivalent to:
- ptr = talloc_size(ctx, size);
- if (ptr) memset(ptr, 0, size);
+ ptr = talloc(ctx, type);
+ if (ptr) memset(ptr, 0, sizeof(type));
+
+
+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+void *talloc_zero_size(const void *ctx, size_t size)
+
+The talloc_zero_size() function is useful when you don't have a known type
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_array_p(const void *ctx, type, uint_t count);
+(type *)talloc_array(const void *ctx, type, uint_t count);
-The talloc_array_p() macro is equivalent to:
+The talloc_array() macro is equivalent to:
(type *)talloc_size(ctx, sizeof(type) * count);
except that it provides integer overflow protection for the multiply,
returning NULL if the multiply overflows.
-
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-void *talloc_realloc_p(const void *ctx, void *ptr, type, uint_t count);
-
-The talloc_realloc_p() macro is equivalent to:
+void *talloc_array_size(const void *ctx, size_t size, uint_t count);
- (type *)talloc_realloc(ctx, ptr, sizeof(type) * count);
-
-except that it provides integer overflow protection for the multiply,
-returning NULL if the multiply overflows.
+The talloc_array_size() function is useful when the type is not known
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
talloc_report(root, stdout);
- p2 = talloc_zero(p1, 20);
+ p2 = talloc_zero_size(p1, 20);
if (p2[19] != 0) {
printf("Failed to give zero memory\n");
return False;
p1 = talloc_size(root, 10);
CHECK_SIZE(p1, 10);
- p1 = talloc_realloc(NULL, p1, 20);
+ p1 = talloc_realloc_size(NULL, p1, 20);
CHECK_SIZE(p1, 20);
talloc_new(p1);
- p2 = talloc_realloc(p1, NULL, 30);
+ p2 = talloc_realloc_size(p1, NULL, 30);
talloc_new(p1);
- p2 = talloc_realloc(p1, p2, 40);
+ p2 = talloc_realloc_size(p1, p2, 40);
CHECK_SIZE(p2, 40);
CHECK_SIZE(root, 60);
CHECK_BLOCKS(p1, 4);
- p1 = talloc_realloc(NULL, p1, 20);
+ p1 = talloc_realloc_size(NULL, p1, 20);
CHECK_SIZE(p1, 60);
talloc_increase_ref_count(p2);
- if (talloc_realloc(NULL, p2, 5) != NULL) {
+ if (talloc_realloc_size(NULL, p2, 5) != NULL) {
printf("failed: talloc_realloc() on a referenced pointer should fail\n");
return False;
}
CHECK_BLOCKS(p1, 4);
- talloc_realloc(NULL, p2, 0);
- talloc_realloc(NULL, p2, 0);
+ talloc_realloc_size(NULL, p2, 0);
+ talloc_realloc_size(NULL, p2, 0);
CHECK_BLOCKS(p1, 3);
- if (talloc_realloc(NULL, p1, 0x7fffffff) != NULL) {
+ if (talloc_realloc_size(NULL, p1, 0x7fffffff) != NULL) {
printf("failed: oversize talloc should fail\n");
return False;
}
- talloc_realloc(NULL, p1, 0);
+ talloc_realloc_size(NULL, p1, 0);
CHECK_BLOCKS(root, 1);
CHECK_SIZE(root, 0);
token->mechTypes = talloc_p(NULL, const char *);
for (i = 0; !asn1->has_error &&
0 < asn1_tag_remaining(asn1); i++) {
- token->mechTypes =
- talloc_realloc(NULL, token->mechTypes, (i + 2) *
- sizeof(*token->mechTypes));
+ token->mechTypes = talloc_realloc(NULL,
+ token->mechTypes,
+ const char *, i+2);
asn1_read_OID(asn1, token->mechTypes + i);
if (token->mechTypes[i]) {
talloc_steal(token->mechTypes,
/* add file info to the dirlist pool */
tdl = talloc_realloc(state,
state->dirlist,
- state->dirlist_len + sizeof(struct clilist_file_info));
-
+ struct clilist_file_info,
+ state->dirlist_len + 1);
if (!tdl) {
return False;
}
state->dirlist = tdl;
- state->dirlist_len += sizeof(struct clilist_file_info);
+ state->dirlist_len++;
interpret_long_filename(state->info_level, file, &state->dirlist[state->total_received]);
/* add file info to the dirlist pool */
tdl = talloc_realloc(state,
state->dirlist,
- state->dirlist_len + sizeof(struct clilist_file_info));
+ struct clilist_file_info,
+ state->dirlist_len + 1);
if (!tdl) {
return False;
}
state->dirlist = tdl;
- state->dirlist_len += sizeof(struct clilist_file_info);
+ state->dirlist_len++;
interpret_short_filename(state->info_level, file, &state->dirlist[state->total_received]);
if (chunk_size+1 >= alloc_size) {
char *c2;
alloc_size += 1024;
- c2 = talloc_realloc(mem_ctx, chunk, alloc_size);
+ c2 = talloc_realloc(mem_ctx, chunk, char, alloc_size);
if (!c2) {
errno = ENOMEM;
return NULL;
}
/* allocate array */
- parms->out.changes = talloc_array_p(mem_ctx, struct notify_changes, parms->out.num_changes);
+ parms->out.changes = talloc_array(mem_ctx, struct notify_changes, parms->out.num_changes);
if (!parms->out.changes) {
return NT_STATUS_NO_MEMORY;
}
/* we need to realloc */
req->out.allocated = req->out.size + delta + REQ_OVER_ALLOCATION;
- buf2 = talloc_realloc(req, req->out.buffer, req->out.allocated);
+ buf2 = talloc_realloc(req, req->out.buffer, uint8_t, req->out.allocated);
if (buf2 == NULL) {
smb_panic("out of memory in req_grow_allocation");
}
max_len = (strlen(str)+2) * MAX_BYTES_PER_CHAR;
- blob->data = talloc_realloc(mem_ctx, blob->data, blob->length + max_len);
+ blob->data = talloc_realloc(mem_ctx, blob->data, uint8_t, blob->length + max_len);
if (!blob->data) {
return 0;
}
if (parms->out.setup_count > 0) {
int i;
- parms->out.setup = talloc_array(mem_ctx, 2, parms->out.setup_count, "setup");
+ parms->out.setup = talloc_array(mem_ctx, uint16_t, parms->out.setup_count);
if (!parms->out.setup) {
req->status = NT_STATUS_NO_MEMORY;
return smbcli_request_destroy(req);
if (parms->out.setup_count > 0) {
int i;
- parms->out.setup = talloc_array(mem_ctx, 2, parms->out.setup_count, "setup");
+ parms->out.setup = talloc_array(mem_ctx, uint16_t, parms->out.setup_count);
if (!parms->out.setup) {
req->status = NT_STATUS_NO_MEMORY;
return smbcli_request_destroy(req);
if (data->has_error) return False;
if (data->length < data->ofs+len) {
uint8_t *newp;
- newp = talloc_realloc(NULL, data->data, data->ofs+len);
+ newp = talloc_realloc(NULL, data->data, uint8_t, data->ofs+len);
if (!newp) {
asn1_free(data);
data->has_error = True;
#define NDR_ALLOC_N_SIZE(ndr, s, n, elsize) do { \
- (s) = talloc_array(ndr, elsize, n, __location__); \
+ (s) = talloc_array_size(ndr, elsize, n); \
if (!(s)) return ndr_pull_error(ndr, NDR_ERR_ALLOC, "Alloc %u * %u failed\n", n, elsize); \
} while (0)
if (size > ndr->alloc_size) {
ndr->alloc_size = size;
}
- ndr->data = talloc_realloc(ndr, ndr->data, ndr->alloc_size);
+ ndr->data = talloc_realloc(ndr, ndr->data, uint8_t, ndr->alloc_size);
if (!ndr->data) {
return ndr_push_error(ndr, NDR_ERR_ALLOC, "Failed to push_expand to %u",
ndr->alloc_size);
if (length > 0) {
req->payload.data = talloc_realloc(req,
req->payload.data,
+ uint8_t,
req->payload.length + length);
if (!req->payload.data) {
req->status = NT_STATUS_NO_MEMORY;
}
/* initiate another read request, as we only got part of a fragment */
- state->data.data = talloc_realloc(state, state->data.data, frag_length);
+ state->data.data = talloc_realloc(state, state->data.data, uint8_t, frag_length);
io->readx.in.mincnt = MIN(state->p->srv_max_xmit_frag,
frag_length - state->received);
frag_length = dcerpc_get_frag_length(&sock->recv.data);
sock->recv.data.data = talloc_realloc(sock, sock->recv.data.data,
- frag_length);
+ uint8_t, frag_length);
if (sock->recv.data.data == NULL) {
sock_dead(p, NT_STATUS_NO_MEMORY);
return;
dir->no_wildcard = False;
dir->end_of_search = False;
dir->offset = 0;
- dir->name_cache = talloc_zero_array_p(dir,
- struct name_cache_entry,
- NAME_CACHE_SIZE);
+ dir->name_cache = talloc_zero_array(dir,
+ struct name_cache_entry,
+ NAME_CACHE_SIZE);
if (dir->name_cache == NULL) {
talloc_free(dir);
return NT_STATUS_NO_MEMORY;
blob = data_blob(NULL, 0);
}
if (count+offset > blob.length) {
- blob.data = talloc_realloc(blob.data, blob.data, count+offset);
+ blob.data = talloc_realloc(blob.data, blob.data, uint8_t, count+offset);
if (blob.data == NULL) {
errno = ENOMEM;
return -1;
if (length <= blob.length) {
blob.length = length;
} else if (length > blob.length) {
- blob.data = talloc_realloc(blob.data, blob.data, length);
+ blob.data = talloc_realloc(blob.data, blob.data, uint8_t, length);
if (blob.data == NULL) {
return NT_STATUS_NO_MEMORY;
}
}
if (ret == -1 && errno == ERANGE) {
estimated_size *= 2;
- blob->data = talloc_realloc(mem_ctx, blob->data, estimated_size);
+ blob->data = talloc_realloc(mem_ctx, blob->data,
+ uint8_t, estimated_size);
if (blob->data == NULL) {
return NT_STATUS_NO_MEMORY;
}
}
call->pkt.u.request.stub_and_verifier.data =
- talloc_realloc(call, call->pkt.u.request.stub_and_verifier.data, alloc_size);
+ talloc_realloc(call,
+ call->pkt.u.request.stub_and_verifier.data,
+ uint8_t, alloc_size);
if (!call->pkt.u.request.stub_and_verifier.data) {
return dcesrv_fault(call2, DCERPC_FAULT_OTHER);
}
dce_conn->partial_input.data = talloc_realloc(dce_conn,
dce_conn->partial_input.data,
+ uint8_t,
dce_conn->partial_input.length + data->length);
if (!dce_conn->partial_input.data) {
return NT_STATUS_NO_MEMORY;
{
trans->out.setup_count = setup_count;
if (setup_count != 0) {
- trans->out.setup = talloc_zero_array_p(req, uint16_t, setup_count);
+ trans->out.setup = talloc_zero_array(req, uint16_t, setup_count);
}
trans->out.params = data_blob_talloc(req, NULL, param_size);
trans->out.data = data_blob_talloc(req, NULL, data_size);
void reply_special(struct smbsrv_request *req)
{
uint8_t msg_type;
- uint8_t *buf = talloc_zero_array_p(req, uint8_t, 4);
+ uint8_t *buf = talloc_zero_array(req, uint8_t, 4);
msg_type = CVAL(req->in.buffer,0);
/* over allocate by a small amount */
req->out.allocated = req->out.size + REQ_OVER_ALLOCATION;
- req->out.buffer = talloc_realloc(req, req->out.buffer, req->out.allocated);
+ req->out.buffer = talloc_realloc(req, req->out.buffer,
+ uint8_t, req->out.allocated);
if (!req->out.buffer) {
smbsrv_terminate_connection(req->smb_conn, "allocation failed");
return;
/* we need to realloc */
req->out.allocated = req->out.size + delta + REQ_OVER_ALLOCATION;
- buf2 = talloc_realloc(req, req->out.buffer, req->out.allocated);
+ buf2 = talloc_realloc(req, req->out.buffer, uint8_t, req->out.allocated);
if (buf2 == NULL) {
smb_panic("out of memory in req_grow_allocation");
}
/* when we have a full NBT header, then allocate the packet */
if (req->in.size == NBT_HDR_SIZE) {
len = smb_len(req->in.buffer) + NBT_HDR_SIZE;
- req->in.buffer = talloc_realloc(req, req->in.buffer, len);
+ req->in.buffer = talloc_realloc(req, req->in.buffer,
+ uint8_t, len);
if (req->in.buffer == NULL) {
return NT_STATUS_NO_MEMORY;
}
if (new_size <= trans->out.data.length) {
return True;
}
- trans->out.data.data = talloc_realloc(req, trans->out.data.data, new_size);
+ trans->out.data.data = talloc_realloc(req, trans->out.data.data,
+ uint8_t, new_size);
return (trans->out.data.data != NULL);
}
{
trans->out.setup_count = setup_count;
if (setup_count != 0) {
- trans->out.setup = talloc_zero_array_p(req, uint16_t, setup_count);
+ trans->out.setup = talloc_zero_array(req, uint16_t, setup_count);
}
trans->out.params = data_blob_talloc(req, NULL, param_size);
trans->out.data = data_blob_talloc(req, NULL, data_size);
parm[0].writex.in.wmode = gen_bits_mask(0xFFFF);
parm[0].writex.in.remaining = gen_io_count();
parm[0].writex.in.count = gen_io_count();
- parm[0].writex.in.data = talloc_zero(current_op.mem_ctx, parm[0].writex.in.count);
+ parm[0].writex.in.data = talloc_zero_size(current_op.mem_ctx, parm[0].writex.in.count);
GEN_COPY_PARM;
GEN_SET_FNUM(writex.in.fnum);
idr = idr_init(ctx);
- ids = talloc_zero_array_p(ctx, int, n);
- present = talloc_zero_array_p(ctx, int, n);
+ ids = talloc_zero_array(ctx, int, n);
+ present = talloc_zero_array(ctx, int, n);
for (i=0;i<n;i++) {
ids[i] = -1;
call->paramdesc = talloc_realloc(call->mem_ctx,
call->paramdesc,
+ uint8_t,
len+2);
call->paramdesc[len] = desc;
call->paramdesc[len+1] = '\0';
if ( string_offset + len + 1 > ndr->data_size )
return NT_STATUS_INVALID_PARAMETER;
- *dest = talloc_zero(mem_ctx, len+1);
+ *dest = talloc_zero_size(mem_ctx, len+1);
pull_ascii(*dest, p, len+1, len, 0);
return NT_STATUS_OK;
const char *test_data = "TEST DATA";
uint_t seed = time(NULL);
- buf = talloc_zero(mem_ctx, maxsize);
+ buf = talloc_zero_size(mem_ctx, maxsize);
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
const char *test_data = "TEST DATA";
uint_t seed = time(NULL);
- buf = talloc_zero(mem_ctx, maxsize);
+ buf = talloc_zero_size(mem_ctx, maxsize);
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
const char *test_data = "TEST DATA";
uint_t seed = time(NULL);
- buf = talloc_zero(mem_ctx, maxsize);
+ buf = talloc_zero_size(mem_ctx, maxsize);
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
const char *test_data = "TEST DATA";
uint_t seed = time(NULL);
- buf = talloc_zero(mem_ctx, maxsize);
+ buf = talloc_zero_size(mem_ctx, maxsize);
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
smbcli_close(cli->tree, fnum);
}
- file = talloc_zero_array_p(mem_ctx, union smb_search_data, num_dirs);
- file2 = talloc_zero_array_p(mem_ctx, union smb_search_data, num_dirs);
- file3 = talloc_zero_array_p(mem_ctx, union smb_search_data, num_dirs);
+ file = talloc_zero_array(mem_ctx, union smb_search_data, num_dirs);
+ file2 = talloc_zero_array(mem_ctx, union smb_search_data, num_dirs);
+ file3 = talloc_zero_array(mem_ctx, union smb_search_data, num_dirs);
printf("Search first on %d dirs\n", num_dirs);
uint_t seed = time(NULL);
union smb_fileinfo finfo;
- buf = talloc_zero(mem_ctx, maxsize);
+ buf = talloc_zero_size(mem_ctx, maxsize);
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
uint_t seed = time(NULL);
union smb_fileinfo finfo;
- buf = talloc_zero(mem_ctx, maxsize);
+ buf = talloc_zero_size(mem_ctx, maxsize);
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
uint_t seed = time(NULL);
union smb_fileinfo finfo;
- buf = talloc_zero(mem_ctx, maxsize);
+ buf = talloc_zero_size(mem_ctx, maxsize);
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
uint_t seed = time(NULL);
union smb_fileinfo finfo;
- buf = talloc_zero(mem_ctx, maxsize);
+ buf = talloc_zero_size(mem_ctx, maxsize);
if (!torture_setup_dir(cli, BASEDIR)) {
return False;
TEST_SEC_DESC_EQUAL(account->sdbuf, lsa, &acct_handle);
- found_priv_in_lsa = talloc_zero_array_p(mem_ctx, BOOL, account->privilege_entries);
+ found_priv_in_lsa = talloc_zero_array(mem_ctx, BOOL, account->privilege_entries);
e.in.handle = &acct_handle;
r.in.num_values = 1;
r.in.buffer_size = r.out.buffer_size = talloc_p(mem_ctx, uint32);
*r.in.buffer_size = 0x20;
- r.in.buffer = r.out.buffer = talloc_zero_array_p(mem_ctx, uint8, *r.in.buffer_size);
+ r.in.buffer = r.out.buffer = talloc_zero_array(mem_ctx, uint8, *r.in.buffer_size);
status = dcerpc_winreg_QueryMultipleValues(p, mem_ctx, &r);
if(NT_STATUS_IS_ERR(status)) {
mem_ctx = talloc_init("ndrdump");
- st = talloc_zero(mem_ctx, f->struct_size);
+ st = talloc_zero_size(mem_ctx, f->struct_size);
if (!st) {
printf("Unable to allocate %d bytes\n", f->struct_size);
exit(1);