From af279639387e4cc1171cdb2cdaff0256a1e54be4 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Fri, 12 Jun 2020 17:20:51 +0000 Subject: [PATCH] string: do not free empty strings --- vlib/builtin/string.v | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vlib/builtin/string.v b/vlib/builtin/string.v index 2591742d4a..0bc5b8475e 100644 --- a/vlib/builtin/string.v +++ b/vlib/builtin/string.v @@ -1183,7 +1183,9 @@ pub fn (c byte) is_letter() bool { } pub fn (s &string) free() { - if s.is_lit {return} + if s.is_lit || s.len == 0 { + return + } free(s.str) }