[master] f7ef41daa Plug minor leak

Federico G. Schwindt fgsch at lodoss.net
Wed Jan 1 01:10:10 UTC 2020


commit f7ef41daa750a5269e851c08650524a87246fa0d
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date:   Wed Jan 1 00:21:10 2020 +0000

    Plug minor leak

diff --git a/bin/varnishtest/vtc_client.c b/bin/varnishtest/vtc_client.c
index 2722488a1..7f62e8dbd 100644
--- a/bin/varnishtest/vtc_client.c
+++ b/bin/varnishtest/vtc_client.c
@@ -205,6 +205,8 @@ client_connect(struct vtclog *vl, struct client *c)
  * Client thread
  */
 
+typedef void (*cleanup_f)(void *);
+
 static void *
 client_thread(void *priv)
 {
@@ -222,6 +224,7 @@ client_thread(void *priv)
 
 	vsb = macro_expand(vl, c->connect);
 	AN(vsb);
+	pthread_cleanup_push((cleanup_f)VSB_delete, vsb);
 	c->addr = VSB_data(vsb);
 
 	if (c->repeat == 0)
@@ -243,8 +246,9 @@ client_thread(void *priv)
 		VTCP_close(&fd);
 	}
 	vtc_log(vl, 2, "Ending");
-	VSB_destroy(&vsb);
 	pthread_cleanup_pop(0);
+	pthread_cleanup_pop(0);
+	VSB_delete(vsb);
 	vtc_logclose(vl);
 	return (NULL);
 }


More information about the varnish-commit mailing list