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

patch 8.2.1711: Vim9: leaking memory when using partial

Problem:    Vim9: leaking memory when using partial.
Solution:   Do delete the function even when it was compiled.
This commit is contained in:
Bram Moolenaar
2020-09-19 15:16:50 +02:00
parent 77b20977dc
commit fdeab65db6
5 changed files with 45 additions and 17 deletions

View File

@@ -270,12 +270,18 @@ handle_closure_in_use(ectx_T *ectx, int free_arguments)
{
dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data)
+ ectx->ec_dfunc_idx;
int argcount = ufunc_argcount(dfunc->df_ufunc);
int top = ectx->ec_frame_idx - argcount;
int argcount;
int top;
int idx;
typval_T *tv;
int closure_in_use = FALSE;
if (dfunc->df_ufunc == NULL)
// function was freed
return OK;
argcount = ufunc_argcount(dfunc->df_ufunc);
top = ectx->ec_frame_idx - argcount;
// Check if any created closure is still in use.
for (idx = 0; idx < dfunc->df_closure_count; ++idx)
{