Patch 8.2.2703
Problem:    Vim9: memory leak when failing on locked variable.
Solution:   Free the memory.
Files:      src/vim9execute.c, src/testdir/test_vim9_assign.vim


*** ../vim-8.2.2702/src/vim9execute.c   2021-04-02 14:43:52.947178932 +0200
--- src/vim9execute.c   2021-04-03 19:28:48.622897008 +0200
***************
*** 1944,1950 ****
--- 1944,1953 ----
                    {
                        SOURCING_LNUM = iptr->isn_lnum;
                        if (var_check_permission(di, name) == FAIL)
+                       {
+                           clear_tv(STACK_TV_BOT(0));
                            goto on_error;
+                       }
                        clear_tv(&di->di_tv);
                        di->di_tv = *STACK_TV_BOT(0);
                    }
***************
*** 1966,1972 ****
--- 1969,1978 ----
                    // the value needs to be checked here.
                    SOURCING_LNUM = iptr->isn_lnum;
                    if (value_check_lock(sv->sv_tv->v_lock, sv->sv_name, FALSE))
+                   {
+                       clear_tv(STACK_TV_BOT(0));
                        goto on_error;
+                   }
  
                    clear_tv(sv->sv_tv);
                    *sv->sv_tv = *STACK_TV_BOT(0);
*** ../vim-8.2.2702/src/testdir/test_vim9_assign.vim    2021-04-02 
14:43:52.947178932 +0200
--- src/testdir/test_vim9_assign.vim    2021-04-03 19:29:25.494800320 +0200
***************
*** 1323,1328 ****
--- 1323,1329 ----
    unlet g:var_test
    unlet g:var_prefixed
    unlet g:other_var
+   unlet g:globConst
    unlet g:FOO
    unlet g:FOOS
    unlet g:FLIST
***************
*** 1375,1381 ****
      SetGlobalConst()
      g:globConst = 234
    END
!   CheckScriptFailure(lines, 'E741: Value is locked: globConst', 1)
    unlet g:globConst
  
    lines =<< trim END
--- 1376,1382 ----
      SetGlobalConst()
      g:globConst = 234
    END
!   CheckScriptFailure(lines, 'E741: Value is locked: g:globConst', 6)
    unlet g:globConst
  
    lines =<< trim END
*** ../vim-8.2.2702/src/version.c       2021-04-03 19:07:02.106066631 +0200
--- src/version.c       2021-04-03 19:32:26.174324758 +0200
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2703,
  /**/

-- 
Never go to the toilet in a paperless office.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202104031733.133HX99q2582434%40masaka.moolenaar.net.

Raspunde prin e-mail lui