Wait for async DNS to complete before freeing resources

* src/process.c (Fdelete_process): Wait for async DNS to
complete before freeing the data structures it needs.
This commit is contained in:
Lars Ingebrigtsen 2016-02-29 14:20:09 +11:00
parent f195dd692b
commit 9671650a7c

View file

@ -845,8 +845,24 @@ nil, indicating the current buffer's process. */)
#ifdef HAVE_GETADDRINFO_A
if (p->dns_request)
{
int ret;
gai_cancel (p->dns_request);
free_dns_request (process);
ret = gai_error (p->dns_request);
if (ret == EAI_CANCELED || ret == 0)
free_dns_request (process);
else
{
/* If we're called during shutdown, we don't really about
freeing all the resources. Otherwise wait until
completion, and then free the request. */
if (! inhibit_sentinels)
{
gai_suspend ((const struct gaicb * const*)&p->dns_request,
1, NULL);
free_dns_request (process);
}
}
}
#endif