To: vim_dev@googlegroups.com Subject: Patch 8.2.0138 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.0138 Problem: Memory leak when starting a job fails. Solution: Free the list of arguments. (Ozaki Kiichi, closes #5510) Files: src/channel.c, src/testdir/test_channel.vim *** ../vim-8.2.0137/src/channel.c 2019-12-23 22:59:14.260820709 +0100 --- src/channel.c 2020-01-20 21:55:21.276685677 +0100 *************** *** 5818,5826 **** char_u *cmd = NULL; char **argv = NULL; int argc = 0; #if defined(UNIX) # define USE_ARGV - int i; #else garray_T ga; #endif --- 5818,5826 ---- char_u *cmd = NULL; char **argv = NULL; int argc = 0; + int i; #if defined(UNIX) # define USE_ARGV #else garray_T ga; #endif *************** *** 5994,6000 **** --- 5994,6004 ---- vim_free(ga.ga_data); #endif if (argv != job->jv_argv) + { + for (i = 0; argv[i] != NULL; i++) + vim_free(argv[i]); vim_free(argv); + } free_job_options(&opt); return job; } *** ../vim-8.2.0137/src/testdir/test_channel.vim 2019-12-22 18:28:48.252481062 +0100 --- src/testdir/test_channel.vim 2020-01-20 21:53:29.425140287 +0100 *************** *** 1977,1979 **** --- 1977,1984 ---- call assert_match("%s%s", text[2]) call delete('Xlog') endfunc + + func Test_job_start_fails() + " this was leaking memory + call assert_fails("call job_start([''])", "E474:") + endfunc *** ../vim-8.2.0137/src/version.c 2020-01-20 21:44:28.427348596 +0100 --- src/version.c 2020-01-20 21:59:29.727677520 +0100 *************** *** 744,745 **** --- 744,747 ---- { /* Add new patch number below this line */ + /**/ + 138, /**/ -- Hanson's Treatment of Time: There are never enough hours in a day, but always too many days before Saturday. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///