[prev in list] [next in list] [prev in thread] [next in thread]
List: varnish-commit
Subject: [master] a35554803 Try to clarify for coverity how vsl_delseg() works
From: Nils Goroll <nils.goroll () uplex ! de>
Date: 2020-12-29 10:48:07
Message-ID: 20201229104807.52E01B2D1C () lists ! varnish-cache ! org
[Download RAW message or body]
commit a355548039182446ac94ff82ec9f311ba72005bb
Author: Nils Goroll <nils.goroll@uplex.de>
Date: Tue Dec 29 11:29:57 2020 +0100
Try to clarify for coverity how vsl_delseg() works
Ref CID 1430127, CID 1430118
diff --git a/lib/libvarnishapi/vsm.c b/lib/libvarnishapi/vsm.c
index 6ec9fd536..d9e67ef32 100644
--- a/lib/libvarnishapi/vsm.c
+++ b/lib/libvarnishapi/vsm.c
@@ -304,6 +304,7 @@ static void
vsm_delset(struct vsm_set **p)
{
struct vsm_set *vs;
+ struct vsm_seg *vg;
AN(p);
vs = *p;
@@ -312,10 +313,14 @@ vsm_delset(struct vsm_set **p)
closefd(&vs->fd);
if (vs->dfd >= 0)
closefd(&vs->dfd);
- while (!VTAILQ_EMPTY(&vs->stale))
- vsm_delseg(VTAILQ_FIRST(&vs->stale), 0);
- while (!VTAILQ_EMPTY(&vs->segs))
- vsm_delseg(VTAILQ_FIRST(&vs->segs), 0);
+ while ((vg = VTAILQ_FIRST(&vs->stale)) != NULL) {
+ AN(vg->flags & VSM_FLAG_STALE);
+ vsm_delseg(vg, 0);
+ }
+ while ((vg = VTAILQ_FIRST(&vs->segs)) != NULL) {
+ AZ(vg->flags & VSM_FLAG_STALE);
+ vsm_delseg(vg, 0);
+ }
assert(VTAILQ_EMPTY(&vs->clusters));
VLU_Destroy(&vs->vlu);
FREE_OBJ(vs);
_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic