[master] 499c3de Use malloc() for the vgz structures. Allocating it from the workspace runs into trouble when we reset the workspace as part of ESI:include processing.

Poul-Henning Kamp phk at varnish-cache.org
Tue Feb 15 11:29:46 CET 2011


commit 499c3de911ec8042f7418a60742428c4ae04384d
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Feb 15 10:28:19 2011 +0000

    Use malloc() for the vgz structures.  Allocating it from the workspace
    runs into trouble when we reset the workspace as part of ESI:include
    processing.
    
    Fixes: #861

diff --git a/bin/varnishd/cache_gzip.c b/bin/varnishd/cache_gzip.c
index 4522afd..3a4fda2 100644
--- a/bin/varnishd/cache_gzip.c
+++ b/bin/varnishd/cache_gzip.c
@@ -122,7 +122,9 @@ vgz_alloc_vgz(struct sess *sp, const char *id)
 	struct ws *ws = sp->wrk->ws;
 
 	WS_Assert(ws);
-	vg = (void*)WS_Alloc(ws, sizeof *vg);
+	// XXX: we restore workspace in esi:include
+	// vg = (void*)WS_Alloc(ws, sizeof *vg);
+	ALLOC_OBJ(vg, VGZ_MAGIC);
 	AN(vg);
 	memset(vg, 0, sizeof *vg);
 	vg->magic = VGZ_MAGIC;
@@ -377,6 +379,7 @@ VGZ_Destroy(struct vgz **vgp)
 	    (intmax_t)vg->vz.stop_bit);
 	if (vg->tmp != NULL)
 		WS_Reset(vg->tmp, vg->tmp_snapshot);
+	FREE_OBJ(vg);
 }
 
 /*--------------------------------------------------------------------



More information about the varnish-commit mailing list