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