Skip to content

Commit 93073ac

Browse files
committed
updated for version 7.4.040
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)
1 parent 45e8b16 commit 93073ac

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/eval.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -915,12 +915,13 @@ eval_clear()
915915
/* autoloaded script names */
916916
ga_clear_strings(&ga_loaded);
917917

918-
/* script-local variables */
918+
/* Script-local variables. First clear all the variables and in a second
919+
* loop free the scriptvar_T, because a variable in one script might hold
920+
* a reference to the whole scope of another script. */
919921
for (i = 1; i <= ga_scripts.ga_len; ++i)
920-
{
921922
vars_clear(&SCRIPT_VARS(i));
923+
for (i = 1; i <= ga_scripts.ga_len; ++i)
922924
vim_free(SCRIPT_SV(i));
923-
}
924925
ga_clear(&ga_scripts);
925926

926927
/* unreferenced lists and dicts */

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,8 @@ static char *(features[]) =
738738

739739
static int included_patches[] =
740740
{ /* Add new patch number below this line */
741+
/**/
742+
40,
741743
/**/
742744
39,
743745
/**/

0 commit comments

Comments
 (0)