[master] 9aa8317 Zero the wrk->vgz_rx pointer once we have freed it.

Poul-Henning Kamp phk at varnish-cache.org
Tue Feb 15 14:34:39 CET 2011


commit 9aa8317d68eb57049b7e5666e57f0ca9cedd323c
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Feb 15 13:32:09 2011 +0000

    Zero the wrk->vgz_rx pointer once we have freed it.

diff --git a/bin/varnishd/cache_esi_fetch.c b/bin/varnishd/cache_esi_fetch.c
index 7343285..b650c2a 100644
--- a/bin/varnishd/cache_esi_fetch.c
+++ b/bin/varnishd/cache_esi_fetch.c
@@ -304,6 +304,7 @@ vfp_esi_begin(struct sess *sp, size_t estimate)
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 	/* XXX: snapshot WS's ? We'll need the space */
 
+	AZ(sp->wrk->vgz_rx);
 	if (sp->wrk->is_gzip && sp->wrk->do_gunzip) {
 		sp->wrk->vgz_rx = VGZ_NewUngzip(sp, "U F E");
 		VEP_Init(sp, NULL);
diff --git a/bin/varnishd/cache_fetch.c b/bin/varnishd/cache_fetch.c
index 05e013f..72549c8 100644
--- a/bin/varnishd/cache_fetch.c
+++ b/bin/varnishd/cache_fetch.c
@@ -504,6 +504,7 @@ FetchBody(struct sess *sp, const struct http *hp)
 	 * XXX: Missing:  RFC2616 sec. 4.4 in re 1xx, 204 & 304 responses
 	 */
 
+	AZ(sp->wrk->vgz_rx);
 	AZ(VTAILQ_FIRST(&sp->obj->store));
 	switch (sp->wrk->body_status) {
 	case BS_NONE:
@@ -537,6 +538,7 @@ FetchBody(struct sess *sp, const struct http *hp)
 		INCOMPL();
 	}
 	XXXAZ(sp->wrk->vfp->end(sp));
+	AZ(sp->wrk->vgz_rx);
 	/*
 	 * It is OK for ->end to just leave the last storage segment
 	 * sitting on sp->wrk->storage, we will always call vfp_nop_end()
diff --git a/bin/varnishd/cache_gzip.c b/bin/varnishd/cache_gzip.c
index ea3684d..655398a 100644
--- a/bin/varnishd/cache_gzip.c
+++ b/bin/varnishd/cache_gzip.c
@@ -393,6 +393,7 @@ static void __match_proto__()
 vfp_gunzip_begin(struct sess *sp, size_t estimate)
 {
 	(void)estimate;
+	AZ(sp->wrk->vgz_rx);
 	sp->wrk->vgz_rx = VGZ_NewUngzip(sp, "U F -");
 }
 
@@ -438,6 +439,7 @@ vfp_gunzip_end(struct sess *sp)
 	struct vgz *vg;
 
 	vg = sp->wrk->vgz_rx;
+	sp->wrk->vgz_rx = NULL;
 	CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
 	VGZ_Destroy(&vg);
 	sp->obj->gziped = 0;
@@ -462,6 +464,7 @@ vfp_gzip_begin(struct sess *sp, size_t estimate)
 {
 	(void)estimate;
 
+	AZ(sp->wrk->vgz_rx);
 	sp->wrk->vgz_rx = VGZ_NewGzip(sp, "G F -");
 }
 
@@ -507,6 +510,7 @@ vfp_gzip_end(struct sess *sp)
 	int i;
 
 	vg = sp->wrk->vgz_rx;
+	sp->wrk->vgz_rx = NULL;
 	CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
 	do {
 		VGZ_Ibuf(vg, "", 0);
@@ -587,6 +591,7 @@ vfp_testgzip_end(struct sess *sp)
 	struct vgz *vg;
 
 	vg = sp->wrk->vgz_rx;
+	sp->wrk->vgz_rx = NULL;
 	CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
 	VGZ_UpdateObj(vg, sp->obj);
 	VGZ_Destroy(&vg);



More information about the varnish-commit mailing list