]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-sock/opensock.c
ITS#5939 plug descriptor leak
[openldap] / servers / slapd / back-sock / opensock.c
index 64d3231b827d9474f071bcaa6aae7d52bd23854b..b02e573370fcca23e798f36f22015ec9b9704d77 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2007 The OpenLDAP Foundation.
+ * Copyright 2007-2009 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * top-level directory of the distribution or, alternatively, at
  * <http://www.OpenLDAP.org/license.html>.
  */
+/* ACKNOWLEDGEMENTS:
+ * This work was initially developed by Brian Candler for inclusion
+ * in OpenLDAP Software.
+ */
 
 #include "portable.h"
 
@@ -53,6 +57,7 @@ opensock(
        if ( connect( fd, (struct sockaddr *)&sockun, sizeof(sockun) ) < 0 ) {
                Debug( LDAP_DEBUG_ANY, "socket connect(%s) failed\n",
                        sockpath ? sockpath : "<null>", 0, 0 );
+               close( fd );
                return( NULL );
        }