From: Bram Moolenaar Date: Sat, 30 Jul 2016 21:05:09 +0000 (+0200) Subject: patch 7.4.2131 X-Git-Tag: v7.4.2131 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=57e69ff2cca9edee3546373d04e0dde6810309e5;p=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. --- diff --git a/src/channel.c b/src/channel.c index 722dcb8de..3b8b5afa0 100644 --- a/src/channel.c +++ b/src/channel.c @@ -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,10 +4469,14 @@ 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); } } } diff --git a/src/version.c b/src/version.c index 77a43c1be..c28c38eb1 100644 --- a/src/version.c +++ b/src/version.c @@ -763,6 +763,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 2131, /**/ 2130, /**/