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

builtin: fix leaks in os.execute() and []string{} == []string{}

This commit is contained in:
Delyan Angelov
2021-03-23 20:36:19 +02:00
parent d098a3caca
commit 7f91b75cbc
2 changed files with 22 additions and 7 deletions

View File

@ -685,8 +685,12 @@ pub fn (a1 []string) eq(a2 []string) bool {
if a1.len != a2.len {
return false
}
size_of_string := int(sizeof(string))
for i in 0 .. a1.len {
if a1[i] != a2[i] {
offset := i * size_of_string
s1 := &string(unsafe { byteptr(a1.data) + offset })
s2 := &string(unsafe { byteptr(a2.data) + offset })
if *s1 != *s2 {
return false
}
}