From: Bram Moolenaar Date: Sat, 21 Nov 2020 10:45:50 +0000 (+0100) Subject: patch 8.2.2023: Vim: memory leak when :execute fails X-Git-Tag: v8.2.2023 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c71ee829efa948eefec3b8f0dbacf172fc1a4992;p=vim patch 8.2.2023: Vim: memory leak when :execute fails Problem: Vim: memory leak when :execute fails. Solution: Clear the growarray. --- diff --git a/src/version.c b/src/version.c index 303ecb3ee..5996bd67f 100644 --- a/src/version.c +++ b/src/version.c @@ -750,6 +750,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 2023, /**/ 2022, /**/ diff --git a/src/vim9execute.c b/src/vim9execute.c index eca99f3aa..f15424907 100644 --- 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 {