[master] 65fe9ad Don't modify req after we freed it.
Poul-Henning Kamp
phk at varnish-cache.org
Wed Jun 13 14:15:13 CEST 2012
commit 65fe9ad8a6459d329f4c6b562642d4711793ad9d
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Wed Jun 13 12:14:41 2012 +0000
Don't modify req after we freed it.
Fixes #1147 and #1148
diff --git a/bin/varnishd/cache/cache_center.c b/bin/varnishd/cache/cache_center.c
index e524421..32f67e5 100644
--- a/bin/varnishd/cache/cache_center.c
+++ b/bin/varnishd/cache/cache_center.c
@@ -120,6 +120,8 @@ cnt_wait(struct sess *sp, struct worker *wrk, struct req *req)
HTC_Init(req->htc, req->ws, sp->fd, sp->req->vsl,
cache_param->http_req_size,
cache_param->http_req_hdr_len);
+ } else {
+ assert(req->sp == sp);
}
AZ(req->vcl);
@@ -943,6 +945,7 @@ cnt_first(struct sess *sp, struct worker *wrk)
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
/* Allocate a request already now, so we can VSL to it */
+ AZ(sp->req);
SES_GetReq(sp);
req = sp->req;
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
@@ -1493,6 +1496,7 @@ cnt_start(struct sess *sp, struct worker *wrk, struct req *req)
AZ(req->vcl);
AZ(req->esi_level);
assert(!isnan(sp->t_req));
+ assert(req->sp == sp);
/* Update stats of various sorts */
wrk->stats.client_req++;
diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index b5226d7..e3ec28a 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -356,8 +356,8 @@ SES_ReleaseReq(struct sess *sp)
assert(sp->req->sp == sp);
MPL_AssertSane(sp->req);
VSL_Flush(sp->req->vsl, 0);
- MPL_Free(pp->mpl_req, sp->req);
sp->req->sp = NULL;
+ MPL_Free(pp->mpl_req, sp->req);
sp->req = NULL;
}
More information about the varnish-commit
mailing list