[6.0] 0644d58ab A request body now might have up to two references

Reza Naghibi reza at naghibi.com
Wed Aug 19 13:12:08 UTC 2020


commit 0644d58abe07a18a972ead14e4aa304c80f354e7
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Wed Jan 15 18:13:45 2020 +0100

    A request body now might have up to two references
    
    since d4b6228e1e32cda3014eeff0a5cb60cd7a0b5474 the busyobj might also
    gain one, so depending on who deref's first, there may be one or zero
    references left.

diff --git a/bin/varnishd/cache/cache_req_body.c b/bin/varnishd/cache/cache_req_body.c
index 40f698be3..f411fc66a 100644
--- a/bin/varnishd/cache/cache_req_body.c
+++ b/bin/varnishd/cache/cache_req_body.c
@@ -263,11 +263,17 @@ VRB_Ignore(struct req *req)
 void
 VRB_Free(struct req *req)
 {
+	int r;
 
 	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 
-	if (req->body_oc != NULL)
-		AZ(HSH_DerefObjCore(req->wrk, &req->body_oc, 0));
+	if (req->body_oc == NULL)
+		return;
+
+	r = HSH_DerefObjCore(req->wrk, &req->body_oc, 0);
+
+	// a busyobj may have gained a reference
+	assert (r == 0 || r == 1);
 }
 
 /*----------------------------------------------------------------------


More information about the varnish-commit mailing list