From af3ccd794643e37f8fd711b9d6c0ccf2f4d8bd3b Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Tue, 29 Jan 2019 20:13:12 +0000 Subject: [PATCH] Unix sk_namelookup: fix compile failure at -DNO_IPV6. The variable 'strbuf *realhost' was only initialised in the branch of the ifdefs where IPV6 is enabled, so at NO_IPV6, it's used uninitialised, which in my usual build configuration means a compile failure. --- unix/uxnet.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/unix/uxnet.c b/unix/uxnet.c index 231686be..e01fea24 100644 --- a/unix/uxnet.c +++ b/unix/uxnet.c @@ -195,7 +195,7 @@ SockAddr *sk_namelookup(const char *host, char **canonicalname, int address_fami struct hostent *h = NULL; int n; #endif - strbuf *realhost; + strbuf *realhost = strbuf_new(); /* Clear the structure and default to IPv4. */ memset(ret, 0, sizeof(SockAddr)); @@ -225,7 +225,6 @@ SockAddr *sk_namelookup(const char *host, char **canonicalname, int address_fami } ret->superfamily = IP; - realhost = strbuf_new(); if (ret->ais->ai_canonname != NULL) strbuf_catf(realhost, "%s", ret->ais->ai_canonname); else