summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-03-05 16:20:34 +0100
committerMichael Adam <obnox@samba.org>2008-03-05 22:36:18 +0100
commit03451a516afd4a9136784c82d8aafe28dfd75233 (patch)
treefbca3a56f3f834713d2d086542d59c9af3d81ce3
parent9f133a602f07c2e1352b76eea8943a7796d90011 (diff)
downloadsamba-03451a516afd4a9136784c82d8aafe28dfd75233.tar.gz
samba-03451a516afd4a9136784c82d8aafe28dfd75233.tar.bz2
samba-03451a516afd4a9136784c82d8aafe28dfd75233.zip
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. (This used to be commit 6cac3127312acaac65fcd54280605605765787ad)
-rw-r--r--source3/rpc_client/cli_lsarpc.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c
index 2759881dd3..0b89488a21 100644
--- a/source3/rpc_client/cli_lsarpc.c
+++ b/source3/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;
}