[master] c79419bf0 vtest: Do not call macro_get() before macro_init()

Nils Goroll nils.goroll at uplex.de
Tue Jan 12 22:24:13 UTC 2021


commit c79419bf0279f3e2f7be3389388f1c4fe584fe15
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Tue Jan 12 23:19:26 2021 +0100

    vtest: Do not call macro_get() before macro_init()
    
    I overlooked use of an uninialized mutex.
    
    Fixes https://github.com/vtest/VTest/issues/26

diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c
index fa7524c2d..31f8cb712 100644
--- a/bin/varnishtest/vtc_main.c
+++ b/bin/varnishtest/vtc_main.c
@@ -606,6 +606,8 @@ ip_magic(void)
 	assert(bad_backend_fd >= 0);
 	VTCP_myname(bad_backend_fd, abuf, sizeof abuf, pbuf, sizeof(pbuf));
 	extmacro_def("localhost", "%s", abuf);
+	s = strdup(abuf);
+	AN(s);
 
 #if defined (__APPLE__)
 	/*
@@ -623,8 +625,6 @@ 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", s);
 	else


More information about the varnish-commit mailing list