summaryrefslogtreecommitdiff
path: root/src/dict.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-09-28 17:25:10 +0200
committerBram Moolenaar <Bram@vim.org>2019-09-28 17:25:10 +0200
commita893194d91a2942d4d54085d746ed137a9251b69 (patch)
tree970558778b2b136d434a8d5c43994f9399c7a5e9 /src/dict.c
parent473952e85286eb9c6098801f1819981ba61ad153 (diff)
downloadvim-git-a893194d91a2942d4d54085d746ed137a9251b69.tar.gz
patch 8.1.2095: leaking memory when getting item from dictv8.1.2095
Problem: Leaking memory when getting item from dict. Solution: Also free the key when not evaluating.
Diffstat (limited to 'src/dict.c')
-rw-r--r--src/dict.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/dict.c b/src/dict.c
index 649a7da71..d26356928 100644
--- a/src/dict.c
+++ b/src/dict.c
@@ -822,7 +822,6 @@ dict_get_tv(char_u **arg, typval_T *rettv, int evaluate, int literal)
goto failret;
}
item = dictitem_alloc(key);
- clear_tv(&tvkey);
if (item != NULL)
{
item->di_tv = tv;
@@ -831,6 +830,7 @@ dict_get_tv(char_u **arg, typval_T *rettv, int evaluate, int literal)
dictitem_free(item);
}
}
+ clear_tv(&tvkey);
if (**arg == '}')
break;