diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-05-28 22:22:34 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-05-28 22:22:34 +0200 |
commit | 655da31a18ef3f888acf10e68b438e2a851f7b14 (patch) | |
tree | 83d8a9b03a2d926d7b94092e975a66f679fd1b70 /src/channel.c | |
parent | d80629cef03cd40b0bf06c402dfe0b720b3bf608 (diff) |
patch 7.4.1855v7.4.1855
Problem: Valgrind reports memory leak for job that is not freed.
Solution: Free all jobs on exit. Add test for failing job.
Diffstat (limited to 'src/channel.c')
-rw-r--r-- | src/channel.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/channel.c b/src/channel.c index 94681ee898..2cc46fecb7 100644 --- a/src/channel.c +++ b/src/channel.c @@ -1285,6 +1285,7 @@ write_buf_line(buf_T *buf, linenr_T lnum, channel_T *channel) int len = (int)STRLEN(line); char_u *p; + /* Need to make a copy to be able to append a NL. */ if ((p = alloc(len + 2)) == NULL) return; STRCPY(p, line); @@ -2888,7 +2889,7 @@ channel_close_now(channel_T *channel) /* * Read from channel "channel" for as long as there is something to read. * "part" is PART_SOCK, PART_OUT or PART_ERR. - * The data is put in the read queue. + * The data is put in the read queue. No callbacks are invoked here. */ static void channel_read(channel_T *channel, int part, char *func) @@ -4184,6 +4185,15 @@ job_free(job_T *job) } } +#if defined(EXITFREE) || defined(PROTO) + void +job_free_all(void) +{ + while (first_job != NULL) + job_free(first_job); +} +#endif + /* * Return TRUE if the job should not be freed yet. Do not free the job when * it has not ended yet and there is a "stoponexit" flag, an exit callback |