1
0
forked from aniani/vim

patch 7.4.2131

Problem:    More memory leaks when using partial, e.g. for "exit-cb".
Solution:   Don't copy the callback when using a partial.
This commit is contained in:
Bram Moolenaar
2016-07-30 23:05:09 +02:00
parent 623e263ffb
commit 57e69ff2cc
2 changed files with 12 additions and 2 deletions

View File

@@ -1272,10 +1272,14 @@ channel_set_req_callback(
if (item != NULL)
{
item->cq_callback = vim_strsave(callback);
item->cq_partial = partial;
if (partial != NULL)
{
++partial->pt_refcount;
item->cq_callback = callback;
}
else
item->cq_callback = vim_strsave(callback);
item->cq_seq_nr = id;
item->cq_prev = head->cq_prev;
head->cq_prev = item;
@@ -4465,11 +4469,15 @@ job_set_options(job_T *job, jobopt_T *opt)
}
else
{
job->jv_exit_cb = vim_strsave(opt->jo_exit_cb);
job->jv_exit_partial = opt->jo_exit_partial;
if (job->jv_exit_partial != NULL)
{
job->jv_exit_cb = opt->jo_exit_cb;
++job->jv_exit_partial->pt_refcount;
}
else
job->jv_exit_cb = vim_strsave(opt->jo_exit_cb);
}
}
}

View File

@@ -763,6 +763,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2131,
/**/
2130,
/**/