mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
Fix compilation of windows evutil_check_ifaddrs
This commit is contained in:
parent
5683e2b1a8
commit
40a3c52d05
8
evutil.c
8
evutil.c
@ -576,6 +576,11 @@ evutil_found_ifaddr(const struct sockaddr *sa)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
typedef ULONG (WINAPI *GetAdaptersAddresses_fn_t)(
|
||||
ULONG, ULONG, PVOID, PIP_ADAPTER_ADDRESSES, PULONG);
|
||||
#endif
|
||||
|
||||
static int
|
||||
evutil_check_ifaddrs(void)
|
||||
{
|
||||
@ -627,7 +632,7 @@ evutil_check_ifaddrs(void)
|
||||
if (res == ERROR_BUFFER_OVERFLOW) {
|
||||
/* we didn't guess that we needed enough space; try again */
|
||||
mm_free(addresses);
|
||||
addresses = tor_malloc(size);
|
||||
addresses = mm_malloc(size);
|
||||
if (!addresses)
|
||||
goto done;
|
||||
res = fn(AF_UNSPEC, FLAGS, NULL, addresses, &size);
|
||||
@ -635,7 +640,6 @@ evutil_check_ifaddrs(void)
|
||||
if (res != NO_ERROR)
|
||||
goto done;
|
||||
|
||||
result = smartlist_create();
|
||||
for (address = addresses; address; address = address->Next) {
|
||||
IP_ADAPTER_UNICAST_ADDRESS *a;
|
||||
for (a = address->FirstUnicastAddress; a; a = a->Next) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user