From 5de0f944bd1df91a2fd51f66342546b994fb405f Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Wed, 1 Jul 2020 17:04:30 +0200 Subject: [PATCH] vweb: fix a template leak --- vlib/strings/builder.v | 4 ++-- vlib/v/gen/comptime.v | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/vlib/strings/builder.v b/vlib/strings/builder.v index 3465506ab7..610c933515 100644 --- a/vlib/strings/builder.v +++ b/vlib/strings/builder.v @@ -115,9 +115,9 @@ pub fn (mut b Builder) str() string { } b.buf << `\0` s := string(b.buf,b.len) - //bis := b.initial_size + bis := b.initial_size //free(b.buf.data) - //b.buf = []byte{cap: bis} + b.buf = []byte{cap: bis} b.len = 0 return s } diff --git a/vlib/v/gen/comptime.v b/vlib/v/gen/comptime.v index 482284ce8a..30173399e7 100644 --- a/vlib/v/gen/comptime.v +++ b/vlib/v/gen/comptime.v @@ -21,7 +21,7 @@ fn (g &Gen) comptime_call(node ast.ComptimeCall) { } } } - g.writeln('vweb__Context_html(&app->vweb, _tmpl_res_$g.fn_decl.name); string_free(&_tmpl_res_$g.fn_decl.name);') + g.writeln('vweb__Context_html(&app->vweb, _tmpl_res_$g.fn_decl.name); strings__Builder_free(&sb); string_free(&_tmpl_res_$g.fn_decl.name);') return } g.writeln('// $' + 'method call. sym="$node.sym.name"')