0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.2.2023: Vim: memory leak when :execute fails

Problem:    Vim: memory leak when :execute fails.
Solution:   Clear the growarray.
This commit is contained in:
Bram Moolenaar 2020-11-21 11:45:50 +01:00
parent 95388e3179
commit c71ee829ef
2 changed files with 8 additions and 0 deletions

View File

@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
2023,
/**/ /**/
2022, 2022,
/**/ /**/

View File

@ -1200,7 +1200,10 @@ call_def_function(
} }
ectx.ec_stack.ga_len -= count; ectx.ec_stack.ga_len -= count;
if (failed) if (failed)
{
ga_clear(&ga);
goto on_error; goto on_error;
}
if (ga.ga_data != NULL) if (ga.ga_data != NULL)
{ {
@ -1209,7 +1212,10 @@ call_def_function(
SOURCING_LNUM = iptr->isn_lnum; SOURCING_LNUM = iptr->isn_lnum;
do_cmdline_cmd((char_u *)ga.ga_data); do_cmdline_cmd((char_u *)ga.ga_data);
if (did_emsg) if (did_emsg)
{
ga_clear(&ga);
goto on_error; goto on_error;
}
} }
else else
{ {