Patch 8.2.0442
Problem:    Channel contents might be used after being freed.
Solution:   Reset the job channel before freeing the channel.
Files:      src/channel.c


*** ../vim-8.2.0441/src/channel.c       2020-03-23 22:01:14.476768276 +0100
--- src/channel.c       2020-03-24 20:32:15.573690231 +0100
***************
*** 396,401 ****
--- 396,402 ----
  
  /*
   * Close a channel and free all its resources.
+  * The "channel" pointer remains valid.
   */
      static void
  channel_free_contents(channel_T *channel)
***************
*** 405,410 ****
--- 406,414 ----
      ch_log(channel, "Freeing channel");
  }
  
+ /*
+  * Unlink "channel" from the list of channels and free it.
+  */
      static void
  channel_free_channel(channel_T *channel)
  {
***************
*** 497,506 ****
        ch_next = ch->ch_next;
        if (!channel_still_useful(ch)
                                 && (ch->ch_copyID & mask) != (copyID & mask))
-       {
            // Free the channel struct itself.
            channel_free_channel(ch);
-       }
      }
  }
  
--- 501,508 ----
***************
*** 4454,4468 ****
        }
        if (channel->ch_to_be_freed || channel->ch_killing)
        {
!           if (channel->ch_killing)
!           {
!               channel_free_contents(channel);
!               channel_free_channel(channel);
                channel->ch_job->jv_channel = NULL;
!           }
!           else
!               channel_free(channel);
!           // channel has been freed, start over
            channel = first_channel;
            continue;
        }
--- 4456,4467 ----
        }
        if (channel->ch_to_be_freed || channel->ch_killing)
        {
!           channel_free_contents(channel);
!           if (channel->ch_job != NULL)
                channel->ch_job->jv_channel = NULL;
! 
!           // free the channel and then start over
!           channel_free_channel(channel);
            channel = first_channel;
            continue;
        }
*** ../vim-8.2.0441/src/version.c       2020-03-24 12:12:26.690758411 +0100
--- src/version.c       2020-03-24 20:34:47.033174235 +0100
***************
*** 740,741 ****
--- 740,743 ----
  {   /* Add new patch number below this line */
+ /**/
+     442,
  /**/

-- 
    [clop clop]
MORTICIAN:  Who's that then?
CUSTOMER:   I don't know.
MORTICIAN:  Must be a king.
CUSTOMER:   Why?
MORTICIAN:  He hasn't got shit all over him.
                                  The Quest for the Holy Grail (Monty Python)

 /// 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/202003241935.02OJZmwD016528%40masaka.moolenaar.net.

Raspunde prin e-mail lui