[master] ffd88acd8 Don't waste workspace on format failure
Nils Goroll
nils.goroll at uplex.de
Fri Apr 30 19:16:05 UTC 2021
commit ffd88acd822f51ffa248dbcc24b57e715e67a435
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date: Wed May 6 15:00:38 2020 +0200
Don't waste workspace on format failure
diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c
index c5a8d1633..b87dae091 100644
--- a/bin/varnishd/cache/cache_vrt.c
+++ b/bin/varnishd/cache/cache_vrt.c
@@ -837,13 +837,17 @@ VCL_STRING v_matchproto_()
VRT_TIME_string(VRT_CTX, VCL_TIME t)
{
char *p;
+ uintptr_t snapshot;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
+ snapshot = WS_Snapshot(ctx->ws);
p = WS_Alloc(ctx->ws, VTIM_FORMAT_SIZE);
if (p != NULL) {
VTIM_format(t, p);
- if (*p == '\0')
+ if (*p == '\0') {
p = NULL;
+ WS_Reset(ctx->ws, snapshot);
+ }
}
return (p);
}
More information about the varnish-commit
mailing list