0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.2703: Vim9: memory leak when failing on locked variable

Problem:    Vim9: memory leak when failing on locked variable.
Solution:   Free the memory.
This commit is contained in:
Bram Moolenaar
2021-04-03 19:32:44 +02:00
parent c17ba791a9
commit 6e50ec2f0a
3 changed files with 10 additions and 1 deletions

View File

@@ -1944,7 +1944,10 @@ call_def_function(
{
SOURCING_LNUM = iptr->isn_lnum;
if (var_check_permission(di, name) == FAIL)
{
clear_tv(STACK_TV_BOT(0));
goto on_error;
}
clear_tv(&di->di_tv);
di->di_tv = *STACK_TV_BOT(0);
}
@@ -1966,7 +1969,10 @@ call_def_function(
// the value needs to be checked here.
SOURCING_LNUM = iptr->isn_lnum;
if (value_check_lock(sv->sv_tv->v_lock, sv->sv_name, FALSE))
{
clear_tv(STACK_TV_BOT(0));
goto on_error;
}
clear_tv(sv->sv_tv);
*sv->sv_tv = *STACK_TV_BOT(0);