Mercurial > vim
changeset 10178:776d0aef1d80 v7.4.2359
commit https://github.com/vim/vim/commit/26fe0d56912e42c2b16a61b2480e19ba569aee98
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Sep 10 14:27:30 2016 +0200
patch 7.4.2359
Problem: Memory leak in timer_start().
Solution: Check the right field to be NULL.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 10 Sep 2016 14:30:07 +0200 |
parents | 4ea4406b620c |
children | a3b72dbc0801 |
files | src/evalfunc.c src/testdir/test_timers.vim src/version.c |
diffstat | 3 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -12429,7 +12429,7 @@ f_timer_start(typval_T *argvars, typval_ free_callback(callback, partial); else { - if (timer->tr_partial == NULL) + if (partial == NULL) timer->tr_callback = vim_strsave(callback); else /* pointer into the partial */
--- 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')