Patch 8.0.0827
Problem:    Coverity: could leak pty file descriptor, theoretically.
Solution:   If channel is NULL, free the file descriptors.
Files:      src/os_unix.c


*** ../vim-8.0.0826/src/os_unix.c       2017-07-28 21:51:53.007136551 +0200
--- src/os_unix.c       2017-08-01 15:00:41.825972980 +0200
***************
*** 4150,4155 ****
--- 4150,4160 ----
  #endif
  
  #if defined(FEAT_GUI) || defined(FEAT_JOB_CHANNEL)
+ /*
+  * Open a PTY, with FD for the master and slave side.
+  * When failing "pty_master_fd" and "pty_slave_fd" are -1.
+  * When successful both file descriptors are stored.
+  */
      static void
  open_pty(int *pty_master_fd, int *pty_slave_fd)
  {
***************
*** 5380,5385 ****
--- 5385,5401 ----
                     ? INVALID_FD : fd_err[0] < 0 ? pty_master_fd : fd_err[0]);
        channel_set_job(channel, job, options);
      }
+     else
+     {
+       if (fd_in[1] >= 0)
+           close(fd_in[1]);
+       if (fd_out[0] >= 0)
+           close(fd_out[0]);
+       if (fd_err[0] >= 0)
+           close(fd_err[0]);
+       if (pty_master_fd >= 0)
+           close(pty_master_fd);
+     }
  
      /* success! */
      return;
*** ../vim-8.0.0826/src/version.c       2017-07-31 22:56:19.964702432 +0200
--- src/version.c       2017-08-01 15:01:26.157654007 +0200
***************
*** 771,772 ****
--- 771,774 ----
  {   /* Add new patch number below this line */
+ /**/
+     827,
  /**/

-- 
Q: How does a UNIX Guru do Sex ?
A: unzip;strip;touch;finger;mount;fsck;more;yes;umount;sleep

 /// 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].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui