diff src/testdir/test_usercommands.vim @ 31493:6c32d1072f82 v9.0.1079

patch 9.0.1079: leaking memory when defining a user command fails Commit: https://github.com/vim/vim/commit/33e543038b84af7557ab9ecff500fc4ab98dd2a3 Author: zeertzjq <zeertzjq@outlook.com> Date: Mon Dec 19 16:49:27 2022 +0000 patch 9.0.1079: leaking memory when defining a user command fails Problem: Leaking memory when defining a user command fails. Solution: Free "compl_arg" when needed. (closes https://github.com/vim/vim/issues/11726)
author Bram Moolenaar <Bram@vim.org>
date Mon, 19 Dec 2022 18:00:04 +0100
parents 8c10a0b22015
children bd01cb097120
line wrap: on
line diff
--- a/src/testdir/test_usercommands.vim
+++ b/src/testdir/test_usercommands.vim
@@ -342,6 +342,11 @@ func Test_CmdErrors()
   call assert_fails('com DoCmd :', 'E174:')
   comclear
   call assert_fails('delcom DoCmd', 'E184:')
+
+  " These used to leak memory
+  call assert_fails('com! -complete=custom,CustomComplete _ :', 'E182:')
+  call assert_fails('com! -complete=custom,CustomComplete docmd :', 'E183:')
+  call assert_fails('com! -complete=custom,CustomComplete -xxx DoCmd :', 'E181:')
 endfunc
 
 func CustomComplete(A, L, P)