patch 7.4.2131 v7.4.2131
authorBram Moolenaar <Bram@vim.org>
Sat, 30 Jul 2016 21:05:09 +0000 (23:05 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 30 Jul 2016 21:05:09 +0000 (23:05 +0200)
Problem:    More memory leaks when using partial, e.g. for "exit-cb".
Solution:   Don't copy the callback when using a partial.

src/channel.c
src/version.c

index 722dcb8de969e8213bb183c79a0fb61303dfe104..3b8b5afa05774d99eed17704cc06e259c4200307 100644 (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,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);
        }
     }
 }
index 77a43c1be30ab2f15c8209e5ab72158b9985057f..c28c38eb1e90f5783b981c2afa9d61302fda4118 100644 (file)
@@ -763,6 +763,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2131,
 /**/
     2130,
 /**/