From 665c38677113fb61f5813ce0349b137ebe92ec23 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Tue, 8 Jun 2021 13:28:23 +0300 Subject: [PATCH] builtin: simplify the .si_c and .si_vp cases in StrIntpData.get_fmt_format, free intermediate results --- vlib/builtin/string_interpolation.v | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vlib/builtin/string_interpolation.v b/vlib/builtin/string_interpolation.v index df0cef65a0..9d00ab94be 100644 --- a/vlib/builtin/string_interpolation.v +++ b/vlib/builtin/string_interpolation.v @@ -593,11 +593,15 @@ fn (data StrIntpData) get_fmt_format(mut sb strings.Builder) { } // runes .si_c { - sb.write_string(utf32_to_str(data.d.d_c)) + ss := utf32_to_str(data.d.d_c) + sb.write_string(ss) + ss.free() } // v pointers .si_vp { - sb.write_string(u64(data.d.d_vp).hex()) + ss := u64(data.d.d_vp).hex() + sb.write_string(ss) + ss.free() } else { sb.write_string('***ERROR!***')