[master] b9eaa9436 Revert "Correct WS allocation in tlv_string"

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Fri Nov 15 07:01:07 UTC 2019


commit b9eaa94361aa1da0634cf2d140b2366948660209
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Fri Nov 15 08:00:01 2019 +0100

    Revert "Correct WS allocation in tlv_string"
    
    This reverts commit 1d23a7335eda7741574e9b680401f5acc2a4d67d.

diff --git a/lib/libvmod_proxy/vmod_proxy.c b/lib/libvmod_proxy/vmod_proxy.c
index 222de9c53..58f2db295 100644
--- a/lib/libvmod_proxy/vmod_proxy.c
+++ b/lib/libvmod_proxy/vmod_proxy.c
@@ -105,13 +105,12 @@ tlv_string(VRT_CTX, int tlv)
 
 	if (VPX_tlv(ctx->req, tlv, (void **)&dst, &len))
 		return (NULL);
-	d = WS_Alloc(ctx->ws, len+1);
-	if (d == NULL) {
-		VRT_fail(ctx, "proxy.TLV: out of workspace");
+	if (!WS_ReserveSize(ctx->ws, len+1))
 		return (NULL);
-	}
+	d = ctx->ws->f;
 	memcpy(d, dst, len);
 	d[len] = '\0';
+	WS_Release(ctx->ws, len+1);
 	return (d);
 }
 


More information about the varnish-commit mailing list