[master] 09e0e8e Continuation of #861 fix: The vef structure cannot be on the workspace either.

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


commit 09e0e8ec13433cb15274107060816bac138689dd
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Feb 15 12:04:54 2011 +0000

    Continuation of #861 fix:  The vef structure cannot be on the
    workspace either.

diff --git a/bin/varnishd/cache_esi_fetch.c b/bin/varnishd/cache_esi_fetch.c
index 34d98a4..7723a89 100644
--- a/bin/varnishd/cache_esi_fetch.c
+++ b/bin/varnishd/cache_esi_fetch.c
@@ -308,25 +308,28 @@ vfp_esi_begin(struct sess *sp, size_t estimate)
 		sp->wrk->vgz_rx = VGZ_NewUngzip(sp, "U F E");
 		VEP_Init(sp, NULL);
 	} else if (sp->wrk->is_gunzip && sp->wrk->do_gzip) {
-		vef = (void*)WS_Alloc(sp->ws, sizeof *vef);
-		AN(vef);
-		memset(vef, 0, sizeof *vef);
-		vef->magic = VEF_MAGIC;
+		ALLOC_OBJ(vef, VEF_MAGIC);
+		//vef = (void*)WS_Alloc(sp->ws, sizeof *vef);
+		//AN(vef);
+		//memset(vef, 0, sizeof *vef);
+		//vef->magic = VEF_MAGIC;
 		vef->vgz = VGZ_NewGzip(sp, "G F E");
 		AZ(sp->wrk->vef_priv);
 		sp->wrk->vef_priv = vef;
 		VEP_Init(sp, vfp_vep_callback);
 	} else if (sp->wrk->is_gzip) {
 		sp->wrk->vgz_rx = VGZ_NewUngzip(sp, "U F E");
-		vef = (void*)WS_Alloc(sp->ws, sizeof *vef);
-		AN(vef);
-		memset(vef, 0, sizeof *vef);
-		vef->magic = VEF_MAGIC;
+		ALLOC_OBJ(vef, VEF_MAGIC);
+		//vef = (void*)WS_Alloc(sp->ws, sizeof *vef);
+		//AN(vef);
+		//memset(vef, 0, sizeof *vef);
+		//vef->magic = VEF_MAGIC;
 		vef->vgz = VGZ_NewGzip(sp, "G F E");
 		AZ(sp->wrk->vef_priv);
 		sp->wrk->vef_priv = vef;
 		VEP_Init(sp, vfp_vep_callback);
 	} else {
+		AZ(sp->wrk->vef_priv);
 		VEP_Init(sp, NULL);
 	}
 
@@ -384,6 +387,7 @@ vfp_esi_end(struct sess *sp)
 		VGZ_Destroy(&vef->vgz);
 		XXXAZ(vef->error);
 		sp->obj->gziped = 1;
+		FREE_OBJ(vef);
 	} else {
 		sp->obj->gziped = 0;
 	}
diff --git a/bin/varnishd/cache_gzip.c b/bin/varnishd/cache_gzip.c
index 3a4fda2..ea3684d 100644
--- a/bin/varnishd/cache_gzip.c
+++ b/bin/varnishd/cache_gzip.c
@@ -354,6 +354,7 @@ VGZ_UpdateObj(const struct vgz *vg, struct object *obj)
 {
 
 	CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
+	CHECK_OBJ_NOTNULL(obj, OBJECT_MAGIC);
 	obj->gzip_start	= vg->vz.start_bit;
 	obj->gzip_last	= vg->vz.last_bit;
 	obj->gzip_stop	= vg->vz.stop_bit;



More information about the varnish-commit mailing list