To: vim_dev@googlegroups.com Subject: Patch 8.2.2786 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2786 Problem: Vim9: memory leak when using :s with expression. Solution: Clean up the instruction list. Files: src/vim9compile.c *** ../vim-8.2.2785/src/vim9compile.c 2021-04-19 20:49:58.156857538 +0200 --- src/vim9compile.c 2021-04-19 21:04:37.130647550 +0200 *************** *** 9416,9423 **** break; case ISN_SUBSTITUTE: ! vim_free(isn->isn_arg.subs.subs_cmd); ! vim_free(isn->isn_arg.subs.subs_instr); break; case ISN_LOADS: --- 9416,9430 ---- break; case ISN_SUBSTITUTE: ! { ! 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: *** ../vim-8.2.2785/src/version.c 2021-04-19 20:49:58.160857530 +0200 --- src/version.c 2021-04-19 21:05:35.638491907 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2786, /**/ -- The difference between theory and practice, is that in theory, there is no difference between theory and practice. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///