From: Guus Sliepen Date: Wed, 16 May 2007 14:46:25 +0000 (+0000) Subject: Don't free struct addrinfo too early. Spotted by Christian Cier-Zniewski. X-Git-Tag: release-1.0.8~1 X-Git-Url: https://tinc-vpn.org/git/browse?a=commitdiff_plain;h=6af8900f8e1c7f2fe6a50a991ae6cbd0fd7edd43;p=tinc Don't free struct addrinfo too early. Spotted by Christian Cier-Zniewski. --- diff --git a/src/mingw/device.c b/src/mingw/device.c index 6d916ba5..2813a883 100644 --- a/src/mingw/device.c +++ b/src/mingw/device.c @@ -76,18 +76,20 @@ DWORD WINAPI tapreader(void *bla) { sock = socket(ai->ai_family, SOCK_STREAM, IPPROTO_TCP); - freeaddrinfo(ai); - if(sock < 0) { logger(LOG_ERR, _("System call `%s' failed: %s"), "socket", strerror(errno)); + freeaddrinfo(ai); return -1; } if(connect(sock, ai->ai_addr, ai->ai_addrlen)) { logger(LOG_ERR, _("System call `%s' failed: %s"), "connect", strerror(errno)); + freeaddrinfo(ai); return -1; } + freeaddrinfo(ai); + logger(LOG_DEBUG, _("Tap reader running")); /* Read from tap device and send to parent */