svn commit: samba r20604 - in branches: SAMBA_3_0/source/libsmb SAMBA_3_0_24/source/libsmb

vlendec at samba.org vlendec at samba.org
Mon Jan 8 08:09:30 GMT 2007


Author: vlendec
Date: 2007-01-08 08:09:29 +0000 (Mon, 08 Jan 2007)
New Revision: 20604

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

Log:
Fix two memleaks, Coverity ID 337, merge to 3_0_24
Modified:
   branches/SAMBA_3_0/source/libsmb/namequery.c
   branches/SAMBA_3_0_24/source/libsmb/namequery.c


Changeset:
Modified: branches/SAMBA_3_0/source/libsmb/namequery.c
===================================================================
--- branches/SAMBA_3_0/source/libsmb/namequery.c	2007-01-08 08:05:49 UTC (rev 20603)
+++ branches/SAMBA_3_0/source/libsmb/namequery.c	2007-01-08 08:09:29 UTC (rev 20604)
@@ -1507,6 +1507,7 @@
 	if ( (num_addresses == 0) ) {
 		if ( done_auto_lookup ) {
 			DEBUG(4,("get_dc_list: no servers found\n")); 
+			SAFE_FREE(auto_ip_list);
 			return NT_STATUS_NO_LOGON_SERVERS;
 		}
 		if (internal_resolve_name(domain, 0x1C, ip_list, count,
@@ -1519,6 +1520,7 @@
 
 	if ( (return_iplist = SMB_MALLOC_ARRAY(struct ip_service, num_addresses)) == NULL ) {
 		DEBUG(3,("get_dc_list: malloc fail !\n"));
+		SAFE_FREE(auto_ip_list);
 		return NT_STATUS_NO_MEMORY;
 	}
 

Modified: branches/SAMBA_3_0_24/source/libsmb/namequery.c
===================================================================
--- branches/SAMBA_3_0_24/source/libsmb/namequery.c	2007-01-08 08:05:49 UTC (rev 20603)
+++ branches/SAMBA_3_0_24/source/libsmb/namequery.c	2007-01-08 08:09:29 UTC (rev 20604)
@@ -1505,20 +1505,22 @@
 	   just return the list of DC's.  Or maybe we just failed. */
 		   
 	if ( (num_addresses == 0) ) {
-		if ( !done_auto_lookup ) {
-			if (internal_resolve_name(domain, 0x1C, ip_list, count, resolve_order)) {
-				return NT_STATUS_OK;
-			} else {
-				return NT_STATUS_NO_LOGON_SERVERS;
-			}
-		} else {
+		if ( done_auto_lookup ) {
 			DEBUG(4,("get_dc_list: no servers found\n")); 
+			SAFE_FREE(auto_ip_list);
 			return NT_STATUS_NO_LOGON_SERVERS;
 		}
+		if (internal_resolve_name(domain, 0x1C, ip_list, count,
+					  resolve_order)) {
+			return NT_STATUS_OK;
+		} else {
+			return NT_STATUS_NO_LOGON_SERVERS;
+		}
 	}
 
 	if ( (return_iplist = SMB_MALLOC_ARRAY(struct ip_service, num_addresses)) == NULL ) {
 		DEBUG(3,("get_dc_list: malloc fail !\n"));
+		SAFE_FREE(auto_ip_list);
 		return NT_STATUS_NO_MEMORY;
 	}
 



More information about the samba-cvs mailing list