svn commit: samba r14003 - in branches/SAMBA_3_0/source/printing: .

jra at samba.org jra at samba.org
Wed Mar 8 01:18:22 GMT 2006


Author: jra
Date: 2006-03-08 01:18:18 +0000 (Wed, 08 Mar 2006)
New Revision: 14003

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

Log:
Clarify code that lead to Coverity report #13.
Not a bug, but better to remove false positives.
Jeremy.

Modified:
   branches/SAMBA_3_0/source/printing/lpq_parse.c
   branches/SAMBA_3_0/source/printing/print_generic.c


Changeset:
Modified: branches/SAMBA_3_0/source/printing/lpq_parse.c
===================================================================
--- branches/SAMBA_3_0/source/printing/lpq_parse.c	2006-03-08 01:04:17 UTC (rev 14002)
+++ branches/SAMBA_3_0/source/printing/lpq_parse.c	2006-03-08 01:18:18 UTC (rev 14003)
@@ -971,7 +971,7 @@
   }
 
   /* in the LPRNG case, we skip lines starting by a space.*/
-  if (line && !ret && (printing_type==PRINT_LPRNG) )
+  if (!ret && (printing_type==PRINT_LPRNG) )
   {
   	if (line[0]==' ')
 		return ret;

Modified: branches/SAMBA_3_0/source/printing/print_generic.c
===================================================================
--- branches/SAMBA_3_0/source/printing/print_generic.c	2006-03-08 01:04:17 UTC (rev 14002)
+++ branches/SAMBA_3_0/source/printing/print_generic.c	2006-03-08 01:18:18 UTC (rev 14003)
@@ -193,21 +193,24 @@
 	/* turn the lpq output into a series of job structures */
 	qcount = 0;
 	ZERO_STRUCTP(status);
-	if (numlines)
+	if (numlines) {
 		queue = SMB_MALLOC_ARRAY(print_queue_struct, numlines+1);
+		if (!queue) {
+			file_lines_free(qlines);
+			*q = NULL;
+			return 0;
+		}
+	}
 
-	if (queue) {
-		memset(queue, '\0', sizeof(print_queue_struct)*(numlines+1));
-		for (i=0; i<numlines; i++) {
-			/* parse the line */
-			if (parse_lpq_entry(printing_type,qlines[i],
-					    &queue[qcount],status,qcount==0)) {
-				qcount++;
-			}
-		}		
-	}
+	memset(queue, '\0', sizeof(print_queue_struct)*(numlines+1));
+	for (i=0; i<numlines; i++) {
+		/* parse the line */
+		if (parse_lpq_entry(printing_type,qlines[i],
+				    &queue[qcount],status,qcount==0)) {
+			qcount++;
+		}
+	}		
 	file_lines_free(qlines);
-
         *q = queue;
 	return qcount;
 }



More information about the samba-cvs mailing list