changeset 22952:629472e2e4c5 v8.2.2023

patch 8.2.2023: Vim: memory leak when :execute fails Commit: https://github.com/vim/vim/commit/c71ee829efa948eefec3b8f0dbacf172fc1a4992 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Nov 21 11:45:50 2020 +0100 patch 8.2.2023: Vim: memory leak when :execute fails Problem: Vim: memory leak when :execute fails. Solution: Clear the growarray.
author Bram Moolenaar <Bram@vim.org>
date Sat, 21 Nov 2020 12:00:04 +0100
parents e857d80bab79
children 504f63302ca4
files src/version.c src/vim9execute.c
diffstat 2 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2023,
+/**/
     2022,
 /**/
     2021,
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -1200,7 +1200,10 @@ call_def_function(
 		    }
 		    ectx.ec_stack.ga_len -= count;
 		    if (failed)
+		    {
+			ga_clear(&ga);
 			goto on_error;
+		    }
 
 		    if (ga.ga_data != NULL)
 		    {
@@ -1209,7 +1212,10 @@ call_def_function(
 			    SOURCING_LNUM = iptr->isn_lnum;
 			    do_cmdline_cmd((char_u *)ga.ga_data);
 			    if (did_emsg)
+			    {
+				ga_clear(&ga);
 				goto on_error;
+			    }
 			}
 			else
 			{