[master] 948661aac hash: Fix refcount type in HSH_DerefObjCore()

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Fri Nov 13 11:31:09 UTC 2020


commit 948661aacf62983c2af4ec6bac25b9041029ae90
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Fri Nov 13 12:28:17 2020 +0100

    hash: Fix refcount type in HSH_DerefObjCore()
    
    We want to avoid unsigned integers for reference counting since they
    would hide underflows.

diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index 9e80efcb1..daf8a9cf7 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -981,7 +981,7 @@ HSH_DerefObjCore(struct worker *wrk, struct objcore **ocp, int rushmax)
 	struct objcore *oc;
 	struct objhead *oh;
 	struct rush rush;
-	unsigned r;
+	int r;
 
 	CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
 	TAKE_OBJ_NOTNULL(oc, ocp, OBJCORE_MAGIC);
diff --git a/bin/varnishd/cache/cache_req_body.c b/bin/varnishd/cache/cache_req_body.c
index 19d05f768..bedd342c5 100644
--- a/bin/varnishd/cache/cache_req_body.c
+++ b/bin/varnishd/cache/cache_req_body.c
@@ -269,7 +269,6 @@ VRB_Free(struct req *req)
 
 	r = HSH_DerefObjCore(req->wrk, &req->body_oc, 0);
 
-
 	// each busyobj may have gained a reference
 	assert (r <= req->restarts + 1);
 }


More information about the varnish-commit mailing list