[6.0] 7e57728f9 Only free addrinfo if it is non-NULL

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Wed May 22 09:03:11 UTC 2019


commit 7e57728f91488d645aadcf85535856b5a25a5d4d
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu May 9 07:17:10 2019 +0000

    Only free addrinfo if it is non-NULL

diff --git a/lib/libvarnish/vss.c b/lib/libvarnish/vss.c
index 0ad31a5b9..4431dea0d 100644
--- a/lib/libvarnish/vss.c
+++ b/lib/libvarnish/vss.c
@@ -108,7 +108,7 @@ int
 VSS_resolver_socktype(const char *addr, const char *def_port,
     vss_resolved_f *func, void *priv, const char **err, int socktype)
 {
-	struct addrinfo hints, *res0, *res;
+	struct addrinfo hints, *res0 = NULL, *res;
 	struct suckaddr *vsa;
 	char *h;
 	char *adp, *hop;
@@ -143,7 +143,8 @@ VSS_resolver_socktype(const char *addr, const char *def_port,
 				break;
 		}
 	}
-	freeaddrinfo(res0);
+	if (res0 != NULL)
+		freeaddrinfo(res0);
 	return (ret);
 }
 


More information about the varnish-commit mailing list