Skip to content

Commit

Permalink
patch 7.4.2359
Browse files Browse the repository at this point in the history
Problem:    Memory leak in timer_start().
Solution:   Check the right field to be NULL.
  • Loading branch information
brammool committed Sep 10, 2016
1 parent d47d837 commit 26fe0d5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/evalfunc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
8 changes: 4 additions & 4 deletions src/testdir/test_timers.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2359,
/**/
2358,
/**/
Expand Down

0 comments on commit 26fe0d5

Please sign in to comment.