[master] e95760818 vtest: plug insignificant leak

Nils Goroll nils.goroll at uplex.de
Sun Jan 10 16:56:08 UTC 2021


commit e95760818552ba954d3750638c0b084ee4879214
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Sun Jan 10 17:54:07 2021 +0100

    vtest: plug insignificant leak
    
    introduced with 1c19f3fed3da8fae79ef200f2ebf01625a42bb27
    
    CID 1471724
    
    Ref #3490

diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c
index 9b5a60a25..fa7524c2d 100644
--- a/bin/varnishtest/vtc_main.c
+++ b/bin/varnishtest/vtc_main.c
@@ -585,6 +585,7 @@ ip_magic(void)
 	struct suckaddr *sa;
 	char abuf[VTCP_ADDRBUFSIZE];
 	char pbuf[VTCP_PORTBUFSIZE];
+	char *s;
 
 	/*
 	 * In FreeBSD jails localhost/127.0.0.1 becomes the jails IP#
@@ -622,10 +623,13 @@ ip_magic(void)
 		extmacro_def("bad_backend", "[%s]:%s", abuf, pbuf);
 
 	/* our default bind/listen address */
+	s = macro_get("localhost", NULL);
+	AN(s);
 	if (VSA_Get_Proto(sa) == AF_INET)
-		bprintf(abuf, "%s:0", macro_get("localhost", NULL));
+		bprintf(abuf, "%s:0", s);
 	else
-		bprintf(abuf, "[%s]:0", macro_get("localhost", NULL));
+		bprintf(abuf, "[%s]:0", s);
+	free(s);
 
 	extmacro_def("listen_addr", "%s", abuf);
 	default_listen_addr = strdup(abuf);


More information about the varnish-commit mailing list