mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser,gen: fix `arr << map[key] using map_get_and_set_1, leading to double free
This commit is contained in:
@ -1092,7 +1092,9 @@ fn test_push_arr_string_free() {
|
||||
mut lines := ['hi']
|
||||
s := 'a' + 'b'
|
||||
lines << s
|
||||
s.free() // make sure the data in the array is valid after freeing the string
|
||||
// make sure the data in the array is valid after freeing the string
|
||||
unsafe { s.free() }
|
||||
//
|
||||
println(lines)
|
||||
assert lines.len == 2
|
||||
assert lines[0] == 'hi'
|
||||
|
Reference in New Issue
Block a user