[master] 2bb355c73 vrt: Fix use-after-release

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Fri Aug 27 15:30:09 UTC 2021


commit 2bb355c73c9f1c15c0f20e0d58324d9b381f2b55
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Wed Aug 25 19:00:21 2021 +0200

    vrt: Fix use-after-release

diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c
index fa62c8957..e0eafe374 100644
--- a/bin/varnishd/cache/cache_vrt.c
+++ b/bin/varnishd/cache/cache_vrt.c
@@ -627,8 +627,8 @@ VRT_SetHdr(VRT_CTX , VCL_HEADER hs, const char *pfx, VCL_STRANDS s)
 		p += l;
 	}
 	if (FEATURE(FEATURE_VALIDATE_HEADERS) && !validhdr(b)) {
-		WS_Release(hp->ws, 0);
 		VRT_fail(ctx, "Bad header %s", b);
+		WS_Release(hp->ws, 0);
 		return;
 	}
 	WS_ReleaseP(hp->ws, strchr(p, '\0') + 1);


More information about the varnish-commit mailing list