Mercurial > vim
diff src/vim9execute.c @ 22324:a4ed0de125d9 v8.2.1711
patch 8.2.1711: Vim9: leaking memory when using partial
Commit: https://github.com/vim/vim/commit/fdeab65db60929e28640fd740c333f9bcfea0e15
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Sep 19 15:16:50 2020 +0200
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.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 19 Sep 2020 15:30:04 +0200 |
parents | 663cba20a5a5 |
children | 15003353a464 |
line wrap: on
line diff
--- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -270,12 +270,18 @@ handle_closure_in_use(ectx_T *ectx, int { 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) {