fd493bf
To: vim_dev@googlegroups.com
fd493bf
Subject: Patch 7.4.040
fd493bf
Fcc: outbox
fd493bf
From: Bram Moolenaar <Bram@moolenaar.net>
fd493bf
Mime-Version: 1.0
fd493bf
Content-Type: text/plain; charset=UTF-8
fd493bf
Content-Transfer-Encoding: 8bit
fd493bf
------------
fd493bf
fd493bf
Patch 7.4.040
fd493bf
Problem:    Valgrind error on exit when a script-local variable holds a
fd493bf
	    reference to the scope of another script.
fd493bf
Solution:   First clear all variables, then free the scopes. (ZyX)
fd493bf
Files:	    src/eval.c
fd493bf
fd493bf
fd493bf
*** ../vim-7.4.039/src/eval.c	2013-08-30 16:35:41.000000000 +0200
fd493bf
--- src/eval.c	2013-09-25 20:28:15.000000000 +0200
fd493bf
***************
fd493bf
*** 915,926 ****
fd493bf
      /* autoloaded script names */
fd493bf
      ga_clear_strings(&ga_loaded);
fd493bf
  
fd493bf
!     /* script-local variables */
fd493bf
      for (i = 1; i <= ga_scripts.ga_len; ++i)
fd493bf
-     {
fd493bf
  	vars_clear(&SCRIPT_VARS(i));
fd493bf
  	vim_free(SCRIPT_SV(i));
fd493bf
-     }
fd493bf
      ga_clear(&ga_scripts);
fd493bf
  
fd493bf
      /* unreferenced lists and dicts */
fd493bf
--- 915,927 ----
fd493bf
      /* autoloaded script names */
fd493bf
      ga_clear_strings(&ga_loaded);
fd493bf
  
fd493bf
!     /* Script-local variables. First clear all the variables and in a second
fd493bf
!      * loop free the scriptvar_T, because a variable in one script might hold
fd493bf
!      * a reference to the whole scope of another script. */
fd493bf
      for (i = 1; i <= ga_scripts.ga_len; ++i)
fd493bf
  	vars_clear(&SCRIPT_VARS(i));
fd493bf
+     for (i = 1; i <= ga_scripts.ga_len; ++i)
fd493bf
  	vim_free(SCRIPT_SV(i));
fd493bf
      ga_clear(&ga_scripts);
fd493bf
  
fd493bf
      /* unreferenced lists and dicts */
fd493bf
*** ../vim-7.4.039/src/version.c	2013-09-25 19:13:32.000000000 +0200
fd493bf
--- src/version.c	2013-09-25 20:30:06.000000000 +0200
fd493bf
***************
fd493bf
*** 740,741 ****
fd493bf
--- 740,743 ----
fd493bf
  {   /* Add new patch number below this line */
fd493bf
+ /**/
fd493bf
+     40,
fd493bf
  /**/
fd493bf
fd493bf
-- 
fd493bf
    A KNIGHT rides into shot and hacks him to the ground.  He rides off.
fd493bf
    We stay for a moment on the glade.  A MIDDLE-AGED LADY in a C. & A.
fd493bf
    twin-set emerges from the trees and looks in horror at the body of her
fd493bf
    HUSBAND.
fd493bf
MRS HISTORIAN: FRANK!
fd493bf
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
fd493bf
fd493bf
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
fd493bf
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
fd493bf
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
fd493bf
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///