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

cgen,map: fix leaks in keys() and for x in y

This commit is contained in:
Emily Hudson
2020-06-27 16:00:27 +01:00
committed by GitHub
parent 190f970544
commit 1848eb0973
2 changed files with 4 additions and 1 deletions

View File

@ -448,7 +448,7 @@ pub fn (mut m map) delete(key string) {
// Returns all keys in the map.
// TODO: add optimization in case of no deletes
pub fn (m &map) keys() []string {
mut keys := [''].repeat(m.len)
mut keys := []string{ len:m.len }
mut j := 0
for i := u32(0); i < m.key_values.len; i++ {
if m.key_values.keys[i].str == 0 {