deactivate_process (proc);
}
+#ifdef HAVE_GETADDRINFO_A
+static void
+free_dns_request (Lisp_Object proc)
+{
+ struct Lisp_Process *p = XPROCESS (proc);
+
+ if (p->dns_requests[0]->ar_result)
+ freeaddrinfo (p->dns_requests[0]->ar_result);
+ xfree ((void *)p->dns_requests[0]->ar_request);
+ xfree ((void *)p->dns_requests[0]->ar_name);
+ xfree ((void *)p->dns_requests[0]->ar_service);
+ xfree (p->dns_requests[0]);
+ xfree (p->dns_requests);
+ p->dns_requests = NULL;
+}
+#endif
+
\f
DEFUN ("processp", Fprocessp, Sprocessp, 1, 1, 0,
doc: /* Return t if OBJECT is a process. */)
process = get_process (process);
p = XPROCESS (process);
+#ifdef HAVE_GETADDRINFO_A
+ if (p->dns_requests)
+ {
+ gai_cancel (p->dns_requests[0]);
+ free_dns_request (process);
+ }
+#endif
+
p->raw_status_new = 0;
if (NETCONN1_P (p) || SERIALCONN1_P (p) || PIPECONN1_P (p))
{
if (! p->dns_requests)
return Qnil;
- /* This process should not already be connected (or killed). */
- if (!EQ (p->status, Qconnect))
- return Qnil;
-
ret = gai_error (p->dns_requests[0]);
if (ret == EAI_INPROGRESS)
return Qt;
}
ip_addresses = Fnreverse (ip_addresses);
- freeaddrinfo (p->dns_requests[0]->ar_result);
}
/* The DNS lookup failed. */
- else
+ else if (!EQ (p->status, Qconnect))
{
deactivate_process (proc);
pset_status (p, (list2
build_string (" failed")))));
}
- xfree ((void *)p->dns_requests[0]->ar_request);
- xfree ((void *)p->dns_requests[0]->ar_name);
- xfree ((void *)p->dns_requests[0]->ar_service);
- xfree (p->dns_requests[0]);
- xfree (p->dns_requests);
- p->dns_requests = NULL;
+ free_dns_request (proc);
+
+ /* This process should not already be connected (or killed). */
+ if (!EQ (p->status, Qconnect))
+ return Qnil;
return ip_addresses;
}