changeset 9711:b74515b8f3d4 v7.4.2131

commit https://github.com/vim/vim/commit/57e69ff2cca9edee3546373d04e0dde6810309e5 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 30 23:05:09 2016 +0200 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.
author Christian Brabandt <cb@256bit.org>
date Sat, 30 Jul 2016 23:15:05 +0200
parents d98b423c75cd
children 3677deb0fc62
files src/channel.c src/version.c
diffstat 2 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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 *op
 	}
 	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);
 	}
     }
 }
--- a/src/version.c
+++ b/src/version.c
@@ -764,6 +764,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2131,
+/**/
     2130,
 /**/
     2129,