diff --git a/vlib/v/gen/cgen.v b/vlib/v/gen/cgen.v index 1cdacabd9f..f6beb25eec 100644 --- a/vlib/v/gen/cgen.v +++ b/vlib/v/gen/cgen.v @@ -3310,7 +3310,10 @@ fn (mut g Gen) gen_str_for_array(info table.Array, styp, str_fn_name string) { g.auto_str_funcs.writeln('\t\tstring x = ${field_styp}_str(it);') } g.auto_str_funcs.writeln('\t\tstrings__Builder_write(&sb, x);') - g.auto_str_funcs.writeln('\t\tstring_free(x);') + if info.elem_type != table.bool_type { + // no need to free "true"/"false" literals + g.auto_str_funcs.writeln('\t\tstring_free(x);') + } g.auto_str_funcs.writeln('\t\tif (i < a.len-1) {') g.auto_str_funcs.writeln('\t\t\tstrings__Builder_write(&sb, tos3(", "));') g.auto_str_funcs.writeln('\t\t}')