]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/daemon.c
Changed search attrs to struct berval **.
[openldap] / servers / slapd / daemon.c
index e9f0a09509eb940469e0c6efd84cb5735fa0d03a..911db57cd54f68b91af3add7284a032b9244bfbe 100644 (file)
@@ -17,6 +17,7 @@
 #include <ac/unistd.h>
 
 #include "ldap_pvt.h"
+#include "ldap_pvt_thread.h"
 #include "lutil.h"
 #include "slap.h"
 
@@ -64,12 +65,6 @@ static int waking;
 do { if (w) tcp_write( wake_sds[1], "0", 1 ); } while(0)
 #endif
 
-#ifdef HAVE_NT_SERVICE_MANAGER
-/* in nt_main.c */
-extern ldap_pvt_thread_cond_t                  started_event;
-extern int       is_NT_Service;
-#endif
-
 #ifndef HAVE_WINSOCK
 static
 #endif
@@ -390,7 +385,7 @@ static int slap_get_listener_addresses(
                for (n=2; (sai = sai->ai_next) != NULL; n++) {
                        /* EMPTY */ ;
                }
-               *sal = ch_malloc(n * sizeof(void *));
+               *sal = ch_calloc(n, sizeof(void *));
                if (*sal == NULL) {
                        return -1;
                }
@@ -738,11 +733,10 @@ static Listener * slap_open_listener(
                inet_ntop( AF_INET, &((struct sockaddr_in *)*sal)->sin_addr,
                           addr, sizeof(addr) );
                s = addr;
-               port = ((struct sockaddr_in *)*sal) ->sin_port;
 #else
-               s = inet_ntoa( l.sl_addr.sin_addr );
-               port = l.sl_addr.sin_port;
+               s = inet_ntoa( ((struct sockaddr_in *) *sal)->sin_addr );
 #endif
+               port = ((struct sockaddr_in *)*sal) ->sin_port;
                l.sl_name = ch_malloc( sizeof("IP=255.255.255.255:65535") );
                sprintf( l.sl_name, "IP=%s:%d",
                         s != NULL ? s : "unknown" , port );
@@ -1680,9 +1674,15 @@ slapd_daemon_task(
                        }
 #endif /* LDAP_PF_LOCAL */
                        slapd_close( slap_listeners[l]->sl_sd );
-                       break;
                }
+               if ( slap_listeners[l]->sl_url )
+                       free ( slap_listeners[l]->sl_url );
+               if ( slap_listeners[l]->sl_name )
+                       free ( slap_listeners[l]->sl_name );
+               free ( slap_listeners[l] );
        }
+       free ( slap_listeners );
+       slap_listeners = NULL;
 
 #ifdef NEW_LOGGING
        LDAP_LOG(( "connection", LDAP_LEVEL_CRIT,