diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c index 07ad39dc96..eddc0cd567 100644 --- a/ldap/servers/slapd/daemon.c +++ b/ldap/servers/slapd/daemon.c @@ -1301,9 +1301,7 @@ setup_pr_accept_pds(PRFileDesc **n_tcps, PRFileDesc **s_tcps, PRFileDesc **i_uni LBER_SOCKET socketdesc = SLAPD_INVALID_SOCKET; PRIntn count = 0; size_t n_listeners = 0; - struct POLL_STRUCT *myfds = (struct POLL_STRUCT *)slapi_ch_calloc(1, (count + 1) * sizeof(struct POLL_STRUCT)); - /* Setup the return ptr */ - *fds = myfds; + struct POLL_STRUCT *myfds = NULL; /* How many fds do we have? */ if (n_tcps != NULL) { @@ -1321,6 +1319,10 @@ setup_pr_accept_pds(PRFileDesc **n_tcps, PRFileDesc **s_tcps, PRFileDesc **i_uni } #endif + /* Setup the return ptr and alloc the struct */ + myfds = (struct POLL_STRUCT *)slapi_ch_calloc(1, (count + 1) * sizeof(struct POLL_STRUCT)); + *fds = myfds; + /* Reset count. */ count = 0;