string: fix a one byte leak in .substr()
parent
a297cf8676
commit
d319fe14f0
|
@ -592,6 +592,9 @@ pub fn (s string) substr(start int, end int) string {
|
|||
}
|
||||
}
|
||||
len := end - start
|
||||
if len == s.len {
|
||||
return s.clone()
|
||||
}
|
||||
mut res := string{
|
||||
str: malloc(len + 1)
|
||||
len: len
|
||||
|
|
Loading…
Reference in New Issue