1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

string: do not free empty strings

This commit is contained in:
Alexander Medvednikov 2020-06-12 17:20:51 +00:00
parent ca63b92d4f
commit af27963938

View File

@ -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)
}