[master] 645c1ca Get access to object before trying to use it
Martin Blix Grydeland
martin at varnish-cache.org
Thu Oct 31 13:24:36 CET 2013
commit 645c1ca8e9d18afbbc4d9cf50c9e051a0ca2c573
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date: Thu Oct 31 13:22:31 2013 +0100
Get access to object before trying to use it
Fix issue where object was used before it was looked up with the
stevedore.
diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c
index 00bc090..37ec19e 100644
--- a/bin/varnishd/cache/cache_req_fsm.c
+++ b/bin/varnishd/cache/cache_req_fsm.c
@@ -389,12 +389,16 @@ cnt_lookup(struct worker *wrk, struct req *req)
AZ (oc->flags & OC_F_BUSY);
AZ(req->objcore);
+ o = oc_getobj(&wrk->stats, oc);
+ CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
+ req->obj = o;
+
if (oc->flags & OC_F_PASS) {
/* Found a hit-for-pass */
VSLb(req->vsl, SLT_Debug, "XXXX HIT-FOR-PASS");
VSLb(req->vsl, SLT_HitPass, "%u", req->obj->vxid);
AZ(boc);
- (void)HSH_DerefObjCore(&wrk->stats, &oc);
+ (void)HSH_DerefObj(&wrk->stats, &req->obj);
req->objcore = NULL;
wrk->stats.cache_hitpass++;
req->req_step = R_STP_PASS;
@@ -404,10 +408,6 @@ cnt_lookup(struct worker *wrk, struct req *req)
oh = oc->objhead;
CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC);
- o = oc_getobj(&wrk->stats, oc);
- CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC);
- req->obj = o;
-
VSLb(req->vsl, SLT_Hit, "%u", req->obj->vxid);
VCL_hit_method(req->vcl, wrk, req, NULL, req->http->ws);
More information about the varnish-commit
mailing list