[master] c63ddc8f5 assert magic of vrt_privs when finalizing

Nils Goroll nils.goroll at uplex.de
Mon Jan 11 14:26:03 UTC 2021


commit c63ddc8f5b504764dfb6fed4f580655fa909e8a1
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Fri Nov 27 15:27:31 2020 +0100

    assert magic of vrt_privs when finalizing
    
    Originally suggested by @rezan in
    https://github.com/varnishcache/varnish-cache/pull/3408/commits/4caad2c1858afb399f75230916183d31f57fc908

diff --git a/bin/varnishd/cache/cache_vrt_priv.c b/bin/varnishd/cache/cache_vrt_priv.c
index 00ef67309..9987abe21 100644
--- a/bin/varnishd/cache/cache_vrt_priv.c
+++ b/bin/varnishd/cache/cache_vrt_priv.c
@@ -238,7 +238,9 @@ VCL_TaskLeave(struct vrt_privs *privs)
 	 * a costly operation. Instead we safely walk the whole tree and clear
 	 * the head at the very end.
 	 */
-	VRBT_FOREACH_SAFE(vp, vrt_privs, privs, vp1)
+	VRBT_FOREACH_SAFE(vp, vrt_privs, privs, vp1) {
+		CHECK_OBJ(vp, VRT_PRIV_MAGIC);
 		VRT_priv_fini(vp->priv);
+	}
 	ZERO_OBJ(privs, sizeof *privs);
 }


More information about the varnish-commit mailing list