[Date Prev][Date Next] [Chronological] [Thread] [Top]

core dump when freeing unallocated sockets (ITS#1415)



Full_Name: Peter Marschall
Version: 2.0.18
OS: Linux 2.4.x
URL: 
Submission from: (NULL) (194.145.150.12)


In slap_free_listener_addresses() in file servers/slapd/daemons.c), 
slapd tries to any free listener addresses that are != NULL.

There may be cases, when this is not 100% guaranteed.

The following patch for slap_get_listener_addresses() in file
ervers/slapd/daemons.c (to be applied with patch -l)
should make it absolutely sure:

--- servers/slapd/daemon.c
+++ servers/slapd/daemon.c      Fri Oct 19 12:16:32 2001
@@ -265,7 +265,7 @@
                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;
                }