From: Guus Sliepen <guus@tinc-vpn.org>
Date: Tue, 18 Nov 2008 15:11:27 +0000 (+0000)
Subject: Prevent freeing a NULL pointer when a hostname is unresolvable.
X-Git-Tag: import-tinc-1.1~596^2~31
X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=a36259435c17f76cf12476234a56f40fcd8faf41;p=meshlink

Prevent freeing a NULL pointer when a hostname is unresolvable.
---

diff --git a/src/net_socket.c b/src/net_socket.c
index bf5130d6..753229b4 100644
--- a/src/net_socket.c
+++ b/src/net_socket.c
@@ -300,7 +300,8 @@ begin:
 	}
 
 	if(!c->outgoing->aip) {
-		freeaddrinfo(c->outgoing->ai);
+		if(c->outgoing->ai)
+			freeaddrinfo(c->outgoing->ai);
 		c->outgoing->ai = NULL;
 		goto begin;
 	}