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