svn commit: samba r15173 - branches/SAMBA_3_0/source/utils trunk/source/utils

vlendec at samba.org vlendec at samba.org
Sun Apr 23 10:59:44 GMT 2006


Author: vlendec
Date: 2006-04-23 10:59:44 +0000 (Sun, 23 Apr 2006)
New Revision: 15173

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

Log:
Fix a non-critical memleak
Modified:
   branches/SAMBA_3_0/source/utils/net_sam.c
   trunk/source/utils/net_sam.c


Changeset:
Modified: branches/SAMBA_3_0/source/utils/net_sam.c
===================================================================
--- branches/SAMBA_3_0/source/utils/net_sam.c	2006-04-23 10:16:01 UTC (rev 15172)
+++ branches/SAMBA_3_0/source/utils/net_sam.c	2006-04-23 10:59:44 UTC (rev 15173)
@@ -462,7 +462,6 @@
 {
 	NTSTATUS status;
 	uint32 rid;
-	TALLOC_CTX *ctx;
 	enum SID_NAME_USE type;
 	fstring groupname;
 	DOM_SID sid;
@@ -478,17 +477,13 @@
 		return -1;
 	}
 
-	if ( (ctx = talloc_init("net_sam_createbuiltingroup")) == NULL ) {
-		d_fprintf( stderr, "Memory allocation error\n");
-		return -1;
-	}
-	
 	/* validate the name and get the group */
 	
 	fstrcpy( groupname, "BUILTIN\\" );
 	fstrcat( groupname, argv[0] );
 	
-	if ( !lookup_name(ctx, groupname, LOOKUP_NAME_ALL, NULL, NULL, &sid, &type)) {
+	if ( !lookup_name(tmp_talloc_ctx(), groupname, LOOKUP_NAME_ALL, NULL,
+			  NULL, &sid, &type)) {
 		d_fprintf(stderr, "%s is not a BUILTIN group\n", argv[0]);
 		return -1;
 	}

Modified: trunk/source/utils/net_sam.c
===================================================================
--- trunk/source/utils/net_sam.c	2006-04-23 10:16:01 UTC (rev 15172)
+++ trunk/source/utils/net_sam.c	2006-04-23 10:59:44 UTC (rev 15173)
@@ -462,7 +462,6 @@
 {
 	NTSTATUS status;
 	uint32 rid;
-	TALLOC_CTX *ctx;
 	enum SID_NAME_USE type;
 	fstring groupname;
 	DOM_SID sid;
@@ -478,17 +477,13 @@
 		return -1;
 	}
 
-	if ( (ctx = talloc_init("net_sam_createbuiltingroup")) == NULL ) {
-		d_fprintf( stderr, "Memory allocation error\n");
-		return -1;
-	}
-	
 	/* validate the name and get the group */
 	
 	fstrcpy( groupname, "BUILTIN\\" );
 	fstrcat( groupname, argv[0] );
 	
-	if ( !lookup_name(ctx, groupname, LOOKUP_NAME_ALL, NULL, NULL, &sid, &type)) {
+	if ( !lookup_name(tmp_talloc_ctx(), groupname, LOOKUP_NAME_ALL, NULL,
+			  NULL, &sid, &type)) {
 		d_fprintf(stderr, "%s is not a BUILTIN group\n", argv[0]);
 		return -1;
 	}



More information about the samba-cvs mailing list