From e7d3a1a665d1204d15b00fdbe6716b43d8ef3b4a Mon Sep 17 00:00:00 2001 From: iphydf Date: Tue, 6 Sep 2016 01:10:15 +0100 Subject: [PATCH] Allocate sizeof(IP_ADAPTER_INFO) bytes instead of sizeof(T*). https://msdn.microsoft.com/en-gb/library/windows/desktop/aa365917(v=vs.85).aspx shows an example use of GetAdaptersInfo that does it this way. --- toxcore/LAN_discovery.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toxcore/LAN_discovery.c b/toxcore/LAN_discovery.c index 4edc960a..f0b12a3e 100644 --- a/toxcore/LAN_discovery.c +++ b/toxcore/LAN_discovery.c @@ -49,8 +49,8 @@ static void fetch_broadcast_info(uint16_t port) { broadcast_count = 0; - IP_ADAPTER_INFO *pAdapterInfo = malloc(sizeof(pAdapterInfo)); - unsigned long ulOutBufLen = sizeof(pAdapterInfo); + IP_ADAPTER_INFO *pAdapterInfo = malloc(sizeof(IP_ADAPTER_INFO)); + unsigned long ulOutBufLen = sizeof(IP_ADAPTER_INFO); if (pAdapterInfo == NULL) { return;