[6.0] 5c8880a22 Move boc check before boc->state is dereferenced

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Wed Oct 31 13:08:12 UTC 2018


commit 5c8880a22b62d76c338e6ca270eaeff0dfa51478
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Tue Sep 4 08:44:52 2018 +0200

    Move boc check before boc->state is dereferenced
    
    Refs 9804794a0e876800e4e3ca10e965b568bd37c38e

diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c
index a87462646..182a7a97d 100644
--- a/bin/varnishd/cache/cache_hash.c
+++ b/bin/varnishd/cache/cache_hash.c
@@ -406,11 +406,8 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp,
 		if (oc->flags & OC_F_FAILED)
 			continue;
 
+		CHECK_OBJ_ORNULL(oc->boc, BOC_MAGIC);
 		if (oc->boc != NULL && oc->boc->state < BOS_STREAM) {
-			// XXX does it make sense to have the CHECK_OBJ
-			//     if we access boc->state before it?
-			CHECK_OBJ_ORNULL(oc->boc, BOC_MAGIC);
-
 			if (req->hash_ignore_busy)
 				continue;
 


More information about the varnish-commit mailing list