[master] 776e8c933 Try to clarify for coverity how mgt_vcl_dep_del() works

Nils Goroll nils.goroll at uplex.de
Tue Dec 29 10:48:07 UTC 2020


commit 776e8c9334317f784bff65cb95d6a7ffde84449b
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Tue Dec 29 11:44:07 2020 +0100

    Try to clarify for coverity how mgt_vcl_dep_del() works
    
    Ref CID 1400491

diff --git a/bin/varnishd/mgt/mgt_vcl.c b/bin/varnishd/mgt/mgt_vcl.c
index ab635d7fc..5b8a57115 100644
--- a/bin/varnishd/mgt/mgt_vcl.c
+++ b/bin/varnishd/mgt/mgt_vcl.c
@@ -226,14 +226,17 @@ mgt_vcl_del(struct vclprog *vp)
 	char *p;
 	struct vmoddep *vd;
 	struct vmodfile *vf;
+	struct vcldep *dep;
 
 	CHECK_OBJ_NOTNULL(vp, VCLPROG_MAGIC);
 	assert(VTAILQ_EMPTY(&vp->dto));
 
 	mgt_vcl_symtab_clean(vp);
 
-	while (!VTAILQ_EMPTY(&vp->dfrom))
-		mgt_vcl_dep_del(VTAILQ_FIRST(&vp->dfrom));
+	while ((dep = VTAILQ_FIRST(&vp->dfrom)) != NULL) {
+		assert(dep->from == vp);
+		mgt_vcl_dep_del(dep);
+	}
 
 	VTAILQ_REMOVE(&vclhead, vp, list);
 	if (vp->state != VCL_STATE_LABEL)


More information about the varnish-commit mailing list