diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-04-19 21:06:31 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-04-19 21:06:31 +0200 |
commit | 4f2df37a0d297a0f40ff15f8ce31285c7b529bcd (patch) | |
tree | 83e91b8bcc9c335a95305a95c30cfd3d10b53c4f | |
parent | 2d1c57ed3dd25c44b41b9ddd4cf63c01ae89007e (diff) | |
download | vim-git-4f2df37a0d297a0f40ff15f8ce31285c7b529bcd.tar.gz |
patch 8.2.2786: Vim9: memory leak when using :s with expressionv8.2.2786
Problem: Vim9: memory leak when using :s with expression.
Solution: Clean up the instruction list.
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/vim9compile.c | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/version.c b/src/version.c index 22a2751bd..834196d83 100644 --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2786, +/**/ 2785, /**/ 2784, diff --git a/src/vim9compile.c b/src/vim9compile.c index 027f79d95..0695879e3 100644 --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -9416,8 +9416,15 @@ delete_instr(isn_T *isn) break; case ISN_SUBSTITUTE: - vim_free(isn->isn_arg.subs.subs_cmd); - vim_free(isn->isn_arg.subs.subs_instr); + { + int idx; + isn_T *list = isn->isn_arg.subs.subs_instr; + + vim_free(isn->isn_arg.subs.subs_cmd); + for (idx = 0; list[idx].isn_type != ISN_FINISH; ++idx) + delete_instr(list + idx); + vim_free(list); + } break; case ISN_LOADS: |