svn commit: samba r14284 - in branches/SAMBA_3_0/source/rpc_server: .

jra at samba.org jra at samba.org
Mon Mar 13 03:56:25 GMT 2006


Author: jra
Date: 2006-03-13 03:56:24 +0000 (Mon, 13 Mar 2006)
New Revision: 14284

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

Log:
Fix coverity bug #103. Make code clearer - probably
not a real issue but this code is easier to read.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c
===================================================================
--- branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c	2006-03-13 03:50:28 UTC (rev 14283)
+++ branches/SAMBA_3_0/source/rpc_server/srv_spoolss_nt.c	2006-03-13 03:56:24 UTC (rev 14284)
@@ -7241,6 +7241,8 @@
 	int ret;
 	int fd;
 
+	*count = 0;
+	*lines = NULL;
 
 	/* if no hook then just fill in the default port */
 	
@@ -7259,9 +7261,9 @@
 		ret = smbrun(command, &fd);
 		DEBUG(10,("Returned [%d]\n", ret));
 		if (ret != 0) {
-			if (fd != -1)
+			if (fd != -1) {
 				close(fd);
-			
+			}
 			return WERR_ACCESS_DENIED;
 		}
 
@@ -7289,8 +7291,11 @@
 	char **qlines;
 	int numlines;
 
-	if ( !W_ERROR_IS_OK(result = enumports_hook( &numlines, &qlines )) ) 
+	result = enumports_hook( &numlines, &qlines );
+	if (!W_ERROR_IS_OK(result)) {
+		file_lines_free(qlines);
 		return result;
+	}
 	
 	if(numlines) {
 		if((ports=SMB_MALLOC_ARRAY( PORT_INFO_1, numlines )) == NULL) {
@@ -7304,9 +7309,8 @@
 			DEBUG(6,("Filling port number [%d] with port [%s]\n", i, qlines[i]));
 			fill_port_1(&ports[i], qlines[i]);
 		}
-
-		file_lines_free(qlines);
 	}
+	file_lines_free(qlines);
 
 	*returned = numlines;
 



More information about the samba-cvs mailing list