To: vim_dev@googlegroups.com Subject: Patch 8.0.0344 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0344 Problem: Unlet command leaks memory. (Nikolai Pavlov) Solution: Free the memory on error. (closes #1497) Files: src/eval.c, src/testdir/test_unlet.vim *** ../vim-8.0.0343/src/eval.c 2017-02-20 22:35:29.013423395 +0100 --- src/eval.c 2017-02-20 23:01:52.241052040 +0100 *************** *** 2079,2085 **** --- 2079,2088 ---- } /* existing variable, need to check if it can be changed */ else if (var_check_ro(lp->ll_di->di_flags, name, FALSE)) + { + clear_tv(&var1); return NULL; + } if (len == -1) clear_tv(&var1); *** ../vim-8.0.0343/src/testdir/test_unlet.vim 2016-01-15 18:39:37.000000000 +0100 --- src/testdir/test_unlet.vim 2017-02-20 22:52:35.737385559 +0100 *************** *** 17,19 **** --- 17,23 ---- unlet! does_not_exist call assert_fails('unlet does_not_exist', 'E108:') endfunc + + func Test_unlet_fails() + call assert_fails('unlet v:["count"]', 'E46:') + endfunc *** ../vim-8.0.0343/src/version.c 2017-02-20 22:35:29.017423364 +0100 --- src/version.c 2017-02-20 23:02:56.028555995 +0100 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 344, /**/ -- Imagine a world without hypothetical situations. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///