Fix Coverity ID 454
authorVolker Lendecke <vl@samba.org>
Thu, 24 Jan 2008 15:12:42 +0000 (16:12 +0100)
committerVolker Lendecke <vl@samba.org>
Thu, 24 Jan 2008 15:31:55 +0000 (16:31 +0100)
source/nmbd/nmbd.c

index 344831ddca77cd2ed37ae908da01d1ce6098e69e..378b6f3dbe078627bc1b7779f73b6e7e8be6432b 100644 (file)
@@ -676,11 +676,18 @@ static bool open_sockets(bool isdaemon, int port)
                ClientNMB = 0;
        }
 
+       if (ClientNMB == -1) {
+               return false;
+       }
+
        ClientDGRAM = open_socket_in(SOCK_DGRAM, DGRAM_PORT,
                                           3, &ss,
                                           true);
 
-       if (ClientNMB == -1) {
+       if (ClientDGRAM == -1) {
+               if (ClientNMB != 0) {
+                       close(ClientNMB);
+               }
                return false;
        }