[master] 4e6e4eedc A request body now might have up to two references

Nils Goroll nils.goroll at uplex.de
Wed Jan 15 17:16:07 UTC 2020


commit 4e6e4eedcf078795d3197792d17b1294d79ff616
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 ddb2fdc6e..011b5c511 100644
--- a/bin/varnishd/cache/cache_req_body.c
+++ b/bin/varnishd/cache/cache_req_body.c
@@ -264,11 +264,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