diff options
author | Jeremy Allison <jra@samba.org> | 2007-04-30 02:39:34 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:19:49 -0500 |
commit | be8b0685a55700c6bce3681734800ec6434b0364 (patch) | |
tree | 8616d85686fb147d431eeea435233f45d5ee8d41 /source3/rpcclient | |
parent | 79de0ad9463a5cd64978beae37df79fbb4f74632 (diff) | |
download | samba-be8b0685a55700c6bce3681734800ec6434b0364.tar.gz samba-be8b0685a55700c6bce3681734800ec6434b0364.tar.bz2 samba-be8b0685a55700c6bce3681734800ec6434b0364.zip |
r22589: Make TALLOC_ARRAY consistent across all uses.
Jeremy.
(This used to be commit 8968808c3b5b0208cbad9ac92eaf948f2c546dd9)
Diffstat (limited to 'source3/rpcclient')
-rw-r--r-- | source3/rpcclient/cmd_samr.c | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c index bba2a51ad9..3785fdd5f4 100644 --- a/source3/rpcclient/cmd_samr.c +++ b/source3/rpcclient/cmd_samr.c @@ -700,9 +700,13 @@ static NTSTATUS cmd_samr_query_useraliases(struct rpc_pipe_client *cli, } } - sid2 = TALLOC_ARRAY(mem_ctx, DOM_SID2, num_sids); - if (sid2 == NULL) - return NT_STATUS_NO_MEMORY; + if (num_sids) { + sid2 = TALLOC_ARRAY(mem_ctx, DOM_SID2, num_sids); + if (sid2 == NULL) + return NT_STATUS_NO_MEMORY; + } else { + sid2 = NULL; + } for (i=0; i<num_sids; i++) { sid_copy(&sid2[i].sid, &sids[i]); @@ -1795,11 +1799,15 @@ static NTSTATUS cmd_samr_lookup_names(struct rpc_pipe_client *cli, /* Look up names */ num_names = argc - 2; - if ((names = TALLOC_ARRAY(mem_ctx, const char *, num_names)) == NULL) { - rpccli_samr_close(cli, mem_ctx, &domain_pol); - rpccli_samr_close(cli, mem_ctx, &connect_pol); - result = NT_STATUS_NO_MEMORY; - goto done; + if (num_names) { + if ((names = TALLOC_ARRAY(mem_ctx, const char *, num_names)) == NULL) { + rpccli_samr_close(cli, mem_ctx, &domain_pol); + rpccli_samr_close(cli, mem_ctx, &connect_pol); + result = NT_STATUS_NO_MEMORY; + goto done; + } + } else { + names = NULL; } for (i = 0; i < argc - 2; i++) @@ -1866,12 +1874,15 @@ static NTSTATUS cmd_samr_lookup_rids(struct rpc_pipe_client *cli, /* Look up rids */ num_rids = argc - 2; - rids = TALLOC_ARRAY(mem_ctx, uint32, num_rids); - if ((rids = TALLOC_ARRAY(mem_ctx, uint32, num_rids)) == NULL) { - rpccli_samr_close(cli, mem_ctx, &domain_pol); - rpccli_samr_close(cli, mem_ctx, &connect_pol); - result = NT_STATUS_NO_MEMORY; - goto done; + if (num_rids) { + if ((rids = TALLOC_ARRAY(mem_ctx, uint32, num_rids)) == NULL) { + rpccli_samr_close(cli, mem_ctx, &domain_pol); + rpccli_samr_close(cli, mem_ctx, &connect_pol); + result = NT_STATUS_NO_MEMORY; + goto done; + } + } else { + rids = NULL; } for (i = 0; i < argc - 2; i++) |