[master] cc5df0e Fix memory leak when discarding labels

Martin Blix Grydeland martin at varnish-software.com
Mon Sep 4 14:02:06 CEST 2017

commit cc5df0ef06caa2fca78ba471a6126fcad03fd6a2
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Tue Aug 22 17:43:11 2017 +0200

    Fix memory leak when discarding labels
    The struct vcl and the temperature rwlock were not free'd on
    discarding labels.

diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c
index 09bdca5..9e02f17 100644
--- a/bin/varnishd/cache/cache_vcl.c
+++ b/bin/varnishd/cache/cache_vcl.c
@@ -912,6 +912,8 @@ vcl_cli_discard(struct cli *cli, const char * const *av, void *priv)
 	if (!strcmp(vcl->state, VCL_TEMP_LABEL)) {
 		VTAILQ_REMOVE(&vcl_head, vcl, list);
+		AZ(errno=pthread_rwlock_destroy(&vcl->temp_rwl));
+		FREE_OBJ(vcl);
 	} else if (vcl->temp == VCL_TEMP_COLD)

More information about the varnish-commit mailing list