]> arthur.barton.de Git - netatalk.git/commitdiff
fix a leak socket on error in papd
authordidg <didg>
Fri, 27 Apr 2007 21:29:16 +0000 (21:29 +0000)
committerdidg <didg>
Fri, 27 Apr 2007 21:29:16 +0000 (21:29 +0000)
etc/papd/main.c

index 07276272ded9b493050c7b991eeb1c1b3899938f..1060a2c2fdd417bfe92f7b22913b2c6222991274 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: main.c,v 1.18.6.2.2.1 2007-04-27 11:15:11 didg Exp $
+ * $Id: main.c,v 1.18.6.2.2.2 2007-04-27 21:29:16 didg Exp $
  *
  * Copyright (c) 1990,1995 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -426,7 +426,6 @@ int main( ac, av )
                     }
 #endif /* HAVE_CUPS */
 
-
                    /*
                     * If this fails, we've run out of sockets. Rather than
                     * just die(), let's try to continue. Maybe some sockets
@@ -454,16 +453,20 @@ int main( ac, av )
                     */
                    if ( atp_sresp( pr->p_atp, &atpb ) < 0 ) {
                        LOG(log_error, logtype_papd, "atp_sresp: %m" );
-                       continue;
+                       err = 1;
                    }
 
                    if ( err ) {
+                       if (atp) {
+                          atp_close(atp);
+                        }
                        continue;
                    }
 
                    switch ( c = fork()) {
                    case -1 :
                        LOG(log_error, logtype_papd, "fork: %m" );
+                        atp_close(atp);
                        continue;
 
                    case 0 : /* child */