svn commit: samba r4955 - in branches/SAMBA_4_0/source/auth: .

tridge at samba.org tridge at samba.org
Mon Jan 24 02:19:57 GMT 2005


Author: tridge
Date: 2005-01-24 02:19:57 +0000 (Mon, 24 Jan 2005)
New Revision: 4955

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=4955

Log:
fixed a couple of minor memory leaks in the auth_sam code

Modified:
   branches/SAMBA_4_0/source/auth/auth_sam.c


Changeset:
Modified: branches/SAMBA_4_0/source/auth/auth_sam.c
===================================================================
--- branches/SAMBA_4_0/source/auth/auth_sam.c	2005-01-24 01:51:45 UTC (rev 4954)
+++ branches/SAMBA_4_0/source/auth/auth_sam.c	2005-01-24 02:19:57 UTC (rev 4955)
@@ -357,12 +357,14 @@
 	const char *str;
 	int i;
 	uint_t rid;
+	TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
 
 	group_ret = samdb_search(sam_ctx,
-				 mem_ctx, NULL, &group_msgs, group_attrs,
+				 tmp_ctx, NULL, &group_msgs, group_attrs,
 				 "(&(member=%s)(sAMAccountType=*))", 
 				 msgs[0]->dn);
 	if (group_ret == -1) {
+		talloc_free(tmp_ctx);
 		return NT_STATUS_INTERNAL_DB_CORRUPTION;
 	}
 
@@ -381,6 +383,8 @@
 		NT_STATUS_HAVE_NO_MEMORY(groupSIDs[i]);
 	}
 
+	talloc_free(tmp_ctx);
+
 	str = ldb_msg_find_string(msgs[0], "objectSid", NULL);
 	account_sid = dom_sid_parse_talloc(server_info, str);
 	NT_STATUS_HAVE_NO_MEMORY(account_sid);
@@ -481,6 +485,9 @@
 					     server_info);
 	NT_STATUS_NOT_OK_RETURN(nt_status);
 
+	talloc_free(msgs);
+	talloc_free(domain_msgs);
+
 	return NT_STATUS_OK;
 }
 
@@ -519,6 +526,9 @@
 					     server_info);
 	NT_STATUS_NOT_OK_RETURN(nt_status);
 
+	talloc_free(msgs);
+	talloc_free(domain_msgs);
+
 	return NT_STATUS_OK;
 }
 



More information about the samba-cvs mailing list