0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.4652: leaking memory if assignment fails

Problem:    Leaking memory if assignment fails.
Solution:   Clear assigned value on failure.
This commit is contained in:
Bram Moolenaar
2022-03-31 10:13:47 +01:00
parent 1712518f48
commit d1d2684c80
2 changed files with 4 additions and 0 deletions

View File

@@ -3098,6 +3098,7 @@ exec_instructions(ectx_T *ectx)
if (iptr->isn_type == ISN_STOREEXPORT)
{
semsg(_(e_undefined_variable_str), name);
clear_tv(STACK_TV_BOT(0));
goto on_error;
}
store_var(name, STACK_TV_BOT(0));
@@ -3118,6 +3119,7 @@ exec_instructions(ectx_T *ectx)
{
semsg(_(e_item_not_exported_in_script_str),
name);
clear_tv(STACK_TV_BOT(0));
goto on_error;
}
}