[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-test-2753-g6cac312

Michael Adam obnox at samba.org
Wed Mar 5 22:19:40 GMT 2008


The branch, v3-2-test has been updated
       via  6cac3127312acaac65fcd54280605605765787ad (commit)
      from  5159e3dafa9f9bb85cde6681052d8f54b8bf8a2e (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 6cac3127312acaac65fcd54280605605765787ad
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Mar 5 16:20:34 2008 +0100

    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.

-----------------------------------------------------------------------

Summary of changes:
 source/rpc_client/cli_lsarpc.c |   40 +++++++++++++++++++++-------------------
 1 files changed, 21 insertions(+), 19 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/rpc_client/cli_lsarpc.c b/source/rpc_client/cli_lsarpc.c
index 2759881..0b89488 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;
 }
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list