[6.0] 729a842b9 CHECK_OBJ before deferencing pointer

Reza Naghibi reza at naghibi.com
Mon Sep 14 18:13:09 UTC 2020


commit 729a842b9570b1991d2353a6807ea4aea064e4ed
Author: Reza Naghibi <reza at naghibi.com>
Date:   Mon Sep 14 14:12:14 2020 -0400

    CHECK_OBJ before deferencing pointer

diff --git a/bin/varnishd/cache/cache_vrt_priv.c b/bin/varnishd/cache/cache_vrt_priv.c
index 05aae3f35..f7cf37455 100644
--- a/bin/varnishd/cache/cache_vrt_priv.c
+++ b/bin/varnishd/cache/cache_vrt_priv.c
@@ -203,8 +203,8 @@ VCL_TaskLeave(const struct vcl *vcl, struct vrt_privs *privs)
 	AN(vcl);
 	CHECK_OBJ_NOTNULL(privs, VRT_PRIVS_MAGIC);
 	VTAILQ_FOREACH_SAFE(vp, &privs->privs, list, vp1) {
-		VTAILQ_REMOVE(&privs->privs, vp, list);
 		CHECK_OBJ_NOTNULL(vp, VRT_PRIV_MAGIC);
+		VTAILQ_REMOVE(&privs->privs, vp, list);
 		VRT_priv_fini(vp->priv);
 		ZERO_OBJ(vp, sizeof *vp);
 	}


More information about the varnish-commit mailing list