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 -- [email protected] -- 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    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202001202100.00KL049f028830%40masaka.moolenaar.net.

Raspunde prin e-mail lui