svn commit: samba r25021 - in branches: SAMBA_3_2/source/nmbd SAMBA_3_2_0/source/nmbd

jra at samba.org jra at samba.org
Sat Sep 8 05:12:18 GMT 2007


Author: jra
Date: 2007-09-08 05:12:17 +0000 (Sat, 08 Sep 2007)
New Revision: 25021

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

Log:
Fix coverity #435. Use of -1.
Jeremy.

Modified:
   branches/SAMBA_3_2/source/nmbd/nmbd_subnetdb.c
   branches/SAMBA_3_2_0/source/nmbd/nmbd_subnetdb.c


Changeset:
Modified: branches/SAMBA_3_2/source/nmbd/nmbd_subnetdb.c
===================================================================
--- branches/SAMBA_3_2/source/nmbd/nmbd_subnetdb.c	2007-09-08 04:57:17 UTC (rev 25020)
+++ branches/SAMBA_3_2/source/nmbd/nmbd_subnetdb.c	2007-09-08 05:12:17 UTC (rev 25021)
@@ -124,8 +124,12 @@
 	subrec = SMB_MALLOC_P(struct subnet_record);
 	if (!subrec) {
 		DEBUG(0,("make_subnet: malloc fail !\n"));
-		close(nmb_sock);
-		close(dgram_sock);
+		if (nmb_sock != -1) {
+			close(nmb_sock);
+		}
+		if (dgram_sock != -1) {
+			close(dgram_sock);
+		}
 		return(NULL);
 	}
   
@@ -133,8 +137,12 @@
 
 	if((subrec->subnet_name = SMB_STRDUP(name)) == NULL) {
 		DEBUG(0,("make_subnet: malloc fail for subnet name !\n"));
-		close(nmb_sock);
-		close(dgram_sock);
+		if (nmb_sock != -1) {
+			close(nmb_sock);
+		}
+		if (dgram_sock != -1) {
+			close(dgram_sock);
+		}
 		ZERO_STRUCTP(subrec);
 		SAFE_FREE(subrec);
 		return(NULL);

Modified: branches/SAMBA_3_2_0/source/nmbd/nmbd_subnetdb.c
===================================================================
--- branches/SAMBA_3_2_0/source/nmbd/nmbd_subnetdb.c	2007-09-08 04:57:17 UTC (rev 25020)
+++ branches/SAMBA_3_2_0/source/nmbd/nmbd_subnetdb.c	2007-09-08 05:12:17 UTC (rev 25021)
@@ -124,8 +124,12 @@
 	subrec = SMB_MALLOC_P(struct subnet_record);
 	if (!subrec) {
 		DEBUG(0,("make_subnet: malloc fail !\n"));
-		close(nmb_sock);
-		close(dgram_sock);
+		if (nmb_sock != -1) {
+			close(nmb_sock);
+		}
+		if (dgram_sock != -1) {
+			close(dgram_sock);
+		}
 		return(NULL);
 	}
   
@@ -133,8 +137,12 @@
 
 	if((subrec->subnet_name = SMB_STRDUP(name)) == NULL) {
 		DEBUG(0,("make_subnet: malloc fail for subnet name !\n"));
-		close(nmb_sock);
-		close(dgram_sock);
+		if (nmb_sock != -1) {
+			close(nmb_sock);
+		}
+		if (dgram_sock != -1) {
+			close(dgram_sock);
+		}
 		ZERO_STRUCTP(subrec);
 		SAFE_FREE(subrec);
 		return(NULL);



More information about the samba-cvs mailing list