summaryrefslogtreecommitdiff
path: root/source/rpc_client
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-03-05 16:20:34 +0100
committerKarolin Seeger <kseeger@samba.org>2008-03-06 09:03:21 +0100
commitf990498818e28cbf12fe387746b182c6893d2639 (patch)
treeabce8846de0602074cbd360b88d66e00de6dc0fc /source/rpc_client
parentad711da7972b9ccc8b82c506db830b192a833918 (diff)
downloadsamba-f990498818e28cbf12fe387746b182c6893d2639.tar.gz
Fix coverity ID 525, 526, 527, 528, 529 and 530
Upon failure to allocate one of the arrays, further down the TALLOC_FREE would have looked at the variables given to it without initizalizing. (cherry picked from commit 6cac3127312acaac65fcd54280605605765787ad)
Diffstat (limited to 'source/rpc_client')
-rw-r--r--source/rpc_client/cli_lsarpc.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/source/rpc_client/cli_lsarpc.c b/source/rpc_client/cli_lsarpc.c
index 2759881dd3b..0b89488a21f 100644
--- a/source/rpc_client/cli_lsarpc.c
+++ b/source/rpc_client/cli_lsarpc.c
@@ -243,46 +243,45 @@ NTSTATUS rpccli_lsa_lookup_sids(struct rpc_pipe_client *cli,
POLICY_HND *pol,
int num_sids,
const DOM_SID *sids,
- char ***domains,
- char ***names,
- enum lsa_SidType **types)
+ char ***pdomains,
+ char ***pnames,
+ enum lsa_SidType **ptypes)
{
NTSTATUS result = NT_STATUS_OK;
int sids_left = 0;
int sids_processed = 0;
const DOM_SID *hunk_sids = sids;
- char **hunk_domains = NULL;
- char **hunk_names = NULL;
- enum lsa_SidType *hunk_types = NULL;
+ char **hunk_domains;
+ char **hunk_names;
+ enum lsa_SidType *hunk_types;
+ char **domains = NULL;
+ char **names = NULL;
+ enum lsa_SidType *types = NULL;
if (num_sids) {
- if (!((*domains) = TALLOC_ARRAY(mem_ctx, char *, num_sids))) {
+ if (!(domains = TALLOC_ARRAY(mem_ctx, char *, num_sids))) {
DEBUG(0, ("rpccli_lsa_lookup_sids(): out of memory\n"));
result = NT_STATUS_NO_MEMORY;
goto fail;
}
- if (!((*names) = TALLOC_ARRAY(mem_ctx, char *, num_sids))) {
+ if (!(names = TALLOC_ARRAY(mem_ctx, char *, num_sids))) {
DEBUG(0, ("rpccli_lsa_lookup_sids(): out of memory\n"));
result = NT_STATUS_NO_MEMORY;
goto fail;
}
- if (!((*types) = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_sids))) {
+ if (!(types = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_sids))) {
DEBUG(0, ("rpccli_lsa_lookup_sids(): out of memory\n"));
result = NT_STATUS_NO_MEMORY;
goto fail;
}
- } else {
- (*domains) = NULL;
- (*names) = NULL;
- (*types) = NULL;
}
sids_left = num_sids;
- hunk_domains = *domains;
- hunk_names = *names;
- hunk_types = *types;
+ hunk_domains = domains;
+ hunk_names = names;
+ hunk_types = types;
while (sids_left > 0) {
int hunk_num_sids;
@@ -334,12 +333,15 @@ NTSTATUS rpccli_lsa_lookup_sids(struct rpc_pipe_client *cli,
hunk_types += hunk_num_sids;
}
+ *pdomains = domains;
+ *pnames = names;
+ *ptypes = types;
return result;
fail:
- TALLOC_FREE(*domains);
- TALLOC_FREE(*names);
- TALLOC_FREE(*types);
+ TALLOC_FREE(domains);
+ TALLOC_FREE(names);
+ TALLOC_FREE(types);
return result;
}