]> granicus.if.org Git - vim/commitdiff
patch 8.1.2095: leaking memory when getting item from dict v8.1.2095
authorBram Moolenaar <Bram@vim.org>
Sat, 28 Sep 2019 15:25:10 +0000 (17:25 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 28 Sep 2019 15:25:10 +0000 (17:25 +0200)
Problem:    Leaking memory when getting item from dict.
Solution:   Also free the key when not evaluating.

src/dict.c
src/version.c

index 649a7da71c20c8958f37bdd2e733a72cc498ea03..d26356928b9bf6aece61e73c52e19d2739a9de86 100644 (file)
@@ -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;
index 369807aa51eed33074e0ff3d278db5b523f3acb6..32ddda81b76d4d19d30c59b41dc9cb5c680b26c9 100644 (file)
@@ -757,6 +757,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2095,
 /**/
     2094,
 /**/