]> granicus.if.org Git - vim/commitdiff
patch 7.4.2359 v7.4.2359
authorBram Moolenaar <Bram@vim.org>
Sat, 10 Sep 2016 12:27:30 +0000 (14:27 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 10 Sep 2016 12:27:30 +0000 (14:27 +0200)
Problem:    Memory leak in timer_start().
Solution:   Check the right field to be NULL.

src/evalfunc.c
src/testdir/test_timers.vim
src/version.c

index 906fa39afc90546474b5438c519ec4f1093223e9..7dd5c2a4d2888078b1696d147792943fe5e83c55 100644 (file)
@@ -12429,7 +12429,7 @@ f_timer_start(typval_T *argvars, typval_T *rettv)
        free_callback(callback, partial);
     else
     {
-       if (timer->tr_partial == NULL)
+       if (partial == NULL)
            timer->tr_callback = vim_strsave(callback);
        else
            /* pointer into the partial */
index 07c6876eeeae8ba02713e035fbf5d3f840dcaf31..ebc66658084930512d2cc0e4f7e26374a786ffab 100644 (file)
@@ -48,12 +48,12 @@ endfunc
 
 func Test_with_partial_callback()
   let g:val = 0
-  let s:meow = {}
-  function s:meow.bite(...)
-    let g:val += 1
+  let meow = {'one': 1}
+  function meow.bite(...)
+    let g:val += self.one
   endfunction
 
-  call timer_start(50, s:meow.bite)
+  call timer_start(50, meow.bite)
   let slept = WaitFor('g:val == 1')
   call assert_equal(1, g:val)
   if has('reltime')
index 0767d4afd1f8adbc6711541739640585e01c4ce4..65757ab9dec055ce875b11f283fc29c401a9acdc 100644 (file)
@@ -763,6 +763,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2359,
 /**/
     2358,
 /**/