summaryrefslogtreecommitdiff
path: root/source3/rpc_client/cli_samr.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-12-07 18:25:53 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:53:32 -0500
commitacf9d61421faa6c0055d57fdee7db300dc5431aa (patch)
tree5482afecfe9b4a68b9a1f18d541a3109f8143ab7 /source3/rpc_client/cli_samr.c
parent3bd3be97dc8a581c0502410453091c195e322766 (diff)
downloadsamba-acf9d61421faa6c0055d57fdee7db300dc5431aa.tar.gz
samba-acf9d61421faa6c0055d57fdee7db300dc5431aa.tar.bz2
samba-acf9d61421faa6c0055d57fdee7db300dc5431aa.zip
r4088: Get medieval on our ass about malloc.... :-). Take control of all our allocation
functions so we can funnel through some well known functions. Should help greatly with malloc checking. HEAD patch to follow. Jeremy. (This used to be commit 620f2e608f70ba92f032720c031283d295c5c06a)
Diffstat (limited to 'source3/rpc_client/cli_samr.c')
-rw-r--r--source3/rpc_client/cli_samr.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/source3/rpc_client/cli_samr.c b/source3/rpc_client/cli_samr.c
index 86f6505689..26c29474ea 100644
--- a/source3/rpc_client/cli_samr.c
+++ b/source3/rpc_client/cli_samr.c
@@ -853,13 +853,13 @@ NTSTATUS cli_samr_enum_dom_users(struct cli_state *cli, TALLOC_CTX *mem_ctx,
if (r.num_entries2) {
/* allocate memory needed to return received data */
- *rids = (uint32*)talloc(mem_ctx, sizeof(uint32) * r.num_entries2);
+ *rids = TALLOC_ARRAY(mem_ctx, uint32, r.num_entries2);
if (!*rids) {
DEBUG(0, ("Error in cli_samr_enum_dom_users(): out of memory\n"));
return NT_STATUS_NO_MEMORY;
}
- *dom_users = (char**)talloc(mem_ctx, sizeof(char*) * r.num_entries2);
+ *dom_users = TALLOC_ARRAY(mem_ctx, char*, r.num_entries2);
if (!*dom_users) {
DEBUG(0, ("Error in cli_samr_enum_dom_users(): out of memory\n"));
return NT_STATUS_NO_MEMORY;
@@ -931,8 +931,7 @@ NTSTATUS cli_samr_enum_dom_groups(struct cli_state *cli, TALLOC_CTX *mem_ctx,
if (*num_dom_groups == 0)
goto done;
- if (!((*dom_groups) = (struct acct_info *)
- talloc(mem_ctx, sizeof(struct acct_info) * *num_dom_groups))) {
+ if (!((*dom_groups) = TALLOC_ARRAY(mem_ctx, struct acct_info, *num_dom_groups))) {
result = NT_STATUS_NO_MEMORY;
goto done;
}
@@ -1014,8 +1013,7 @@ NTSTATUS cli_samr_enum_als_groups(struct cli_state *cli, TALLOC_CTX *mem_ctx,
if (*num_dom_aliases == 0)
goto done;
- if (!((*dom_aliases) = (struct acct_info *)
- talloc(mem_ctx, sizeof(struct acct_info) * *num_dom_aliases))) {
+ if (!((*dom_aliases) = TALLOC_ARRAY(mem_ctx, struct acct_info, *num_dom_aliases))) {
result = NT_STATUS_NO_MEMORY;
goto done;
}
@@ -1096,7 +1094,7 @@ NTSTATUS cli_samr_query_aliasmem(struct cli_state *cli, TALLOC_CTX *mem_ctx,
goto done;
}
- if (!(*sids = talloc(mem_ctx, sizeof(DOM_SID) * *num_mem))) {
+ if (!(*sids = TALLOC_ARRAY(mem_ctx, DOM_SID, *num_mem))) {
result = NT_STATUS_UNSUCCESSFUL;
goto done;
}
@@ -1654,8 +1652,8 @@ NTSTATUS cli_samr_lookup_rids(struct cli_state *cli, TALLOC_CTX *mem_ctx,
}
*num_names = r.num_names1;
- *names = talloc(mem_ctx, sizeof(char *) * r.num_names1);
- *name_types = talloc(mem_ctx, sizeof(uint32) * r.num_names1);
+ *names = TALLOC_ARRAY(mem_ctx, char *, r.num_names1);
+ *name_types = TALLOC_ARRAY(mem_ctx, uint32, r.num_names1);
for (i = 0; i < r.num_names1; i++) {
fstring tmp;
@@ -1724,8 +1722,8 @@ NTSTATUS cli_samr_lookup_names(struct cli_state *cli, TALLOC_CTX *mem_ctx,
}
*num_rids = r.num_rids1;
- *rids = talloc(mem_ctx, sizeof(uint32) * r.num_rids1);
- *rid_types = talloc(mem_ctx, sizeof(uint32) * r.num_rids1);
+ *rids = TALLOC_ARRAY(mem_ctx, uint32, r.num_rids1);
+ *rid_types = TALLOC_ARRAY(mem_ctx, uint32, r.num_rids1);
for (i = 0; i < r.num_rids1; i++) {
(*rids)[i] = r.rids[i];