]> granicus.if.org Git - vim/commitdiff
updated for version 7.4.040 v7.4.040
authorBram Moolenaar <Bram@vim.org>
Wed, 25 Sep 2013 19:00:28 +0000 (21:00 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 25 Sep 2013 19:00:28 +0000 (21:00 +0200)
Problem:    Valgrind error on exit when a script-local variable holds a
            reference to the scope of another script.
Solution:   First clear all variables, then free the scopes. (ZyX)

src/eval.c
src/version.c

index 807efe25f3b7666aa5fec8aafe146f1844d31086..03e3735ce9f412753176adb3e6ed140eb056838c 100644 (file)
@@ -915,12 +915,13 @@ eval_clear()
     /* autoloaded script names */
     ga_clear_strings(&ga_loaded);
 
-    /* script-local variables */
+    /* Script-local variables. First clear all the variables and in a second
+     * loop free the scriptvar_T, because a variable in one script might hold
+     * a reference to the whole scope of another script. */
     for (i = 1; i <= ga_scripts.ga_len; ++i)
-    {
        vars_clear(&SCRIPT_VARS(i));
+    for (i = 1; i <= ga_scripts.ga_len; ++i)
        vim_free(SCRIPT_SV(i));
-    }
     ga_clear(&ga_scripts);
 
     /* unreferenced lists and dicts */
index 3495b0ee8e0b17eb1a4e7ec48462d3fa9f4a8f30..c7a2011c149d2aba78823854513e959a88f2e4ad 100644 (file)
@@ -738,6 +738,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    40,
 /**/
     39,
 /**/