diff --git a/src/domain-match.c b/src/domain-match.c index 935a2d3..a5afb35 100644 --- a/src/domain-match.c +++ b/src/domain-match.c @@ -79,7 +79,9 @@ void build_server_array(void) for (serv = daemon->local_domains; serv; serv = serv->next, count++) daemon->serverarray[count] = serv; - qsort(daemon->serverarray, daemon->serverarraysz, sizeof(struct server *), order_qsort); + /* serverarray may be unallocated if we have no servers yet. */ + if (daemon->serverarray) + qsort(daemon->serverarray, daemon->serverarraysz, sizeof(struct server *), order_qsort); /* servers need the location in the array to find all the whole set of equivalent servers from a pointer to a single one. */