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

os: fix a leak in read_lines()

This commit is contained in:
Alexander Medvednikov 2021-03-22 12:20:55 +03:00
parent 57b30507fa
commit a53aaaf9e7

View File

@ -80,7 +80,9 @@ pub fn mv_by_cp(source string, target string) ? {
// read_lines reads the file in `path` into an array of lines.
pub fn read_lines(path string) ?[]string {
buf := read_file(path) ?
return buf.split_into_lines()
res := buf.split_into_lines()
unsafe { buf.free() }
return res
}
// read_ulines reads the file in `path` into an array of ustring lines.