Commit 9bf79d4e authored by Martin Blix Grydeland's avatar Martin Blix Grydeland Committed by Reza Naghibi

Don't waste workspace on format failure

parent 6cb9c766
...@@ -626,13 +626,17 @@ VCL_STRING v_matchproto_() ...@@ -626,13 +626,17 @@ VCL_STRING v_matchproto_()
VRT_TIME_string(VRT_CTX, VCL_TIME t) VRT_TIME_string(VRT_CTX, VCL_TIME t)
{ {
char *p; char *p;
uintptr_t snapshot;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
snapshot = WS_Snapshot(ctx->ws);
p = WS_Alloc(ctx->ws, VTIM_FORMAT_SIZE); p = WS_Alloc(ctx->ws, VTIM_FORMAT_SIZE);
if (p != NULL) { if (p != NULL) {
VTIM_format(t, p); VTIM_format(t, p);
if (*p == '\0') if (*p == '\0') {
p = NULL; p = NULL;
WS_Reset(ctx->ws, snapshot);
}
} }
return (p); return (p);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment