Don't free struct addrinfo too early. Spotted by Christian Cier-Zniewski.
This commit is contained in:
parent
31a190dc7d
commit
6af8900f8e
1 changed files with 4 additions and 2 deletions
|
@ -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 */
|
||||
|
|
Loading…
Reference in a new issue