diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-09-10 14:27:30 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-09-10 14:27:30 +0200 |
commit | 26fe0d56912e42c2b16a61b2480e19ba569aee98 (patch) | |
tree | cd12d74f9b5337de33b8c42fbf3a04196971e51e | |
parent | d47d83745ff450232328ca7a4b8b00b31bad22fc (diff) | |
download | vim-26fe0d56912e42c2b16a61b2480e19ba569aee98.zip |
patch 7.4.2359
Problem: Memory leak in timer_start().
Solution: Check the right field to be NULL.
-rw-r--r-- | src/evalfunc.c | 2 | ||||
-rw-r--r-- | src/testdir/test_timers.vim | 8 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c index 906fa39af..7dd5c2a4d 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -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 */ diff --git a/src/testdir/test_timers.vim b/src/testdir/test_timers.vim index 07c6876ee..ebc666580 100644 --- a/src/testdir/test_timers.vim +++ b/src/testdir/test_timers.vim @@ -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') diff --git a/src/version.c b/src/version.c index 0767d4afd..65757ab9d 100644 --- 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 */ /**/ + 2359, +/**/ 2358, /**/ 2357, |