mirror of
https://github.com/vim/vim.git
synced 2025-09-29 04:34:16 -04:00
patch 7.4.2359
Problem: Memory leak in timer_start(). Solution: Check the right field to be NULL.
This commit is contained in:
@@ -12429,7 +12429,7 @@ f_timer_start(typval_T *argvars, typval_T *rettv)
|
|||||||
free_callback(callback, partial);
|
free_callback(callback, partial);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (timer->tr_partial == NULL)
|
if (partial == NULL)
|
||||||
timer->tr_callback = vim_strsave(callback);
|
timer->tr_callback = vim_strsave(callback);
|
||||||
else
|
else
|
||||||
/* pointer into the partial */
|
/* pointer into the partial */
|
||||||
|
@@ -48,12 +48,12 @@ endfunc
|
|||||||
|
|
||||||
func Test_with_partial_callback()
|
func Test_with_partial_callback()
|
||||||
let g:val = 0
|
let g:val = 0
|
||||||
let s:meow = {}
|
let meow = {'one': 1}
|
||||||
function s:meow.bite(...)
|
function meow.bite(...)
|
||||||
let g:val += 1
|
let g:val += self.one
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call timer_start(50, s:meow.bite)
|
call timer_start(50, meow.bite)
|
||||||
let slept = WaitFor('g:val == 1')
|
let slept = WaitFor('g:val == 1')
|
||||||
call assert_equal(1, g:val)
|
call assert_equal(1, g:val)
|
||||||
if has('reltime')
|
if has('reltime')
|
||||||
|
@@ -763,6 +763,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2359,
|
||||||
/**/
|
/**/
|
||||||
2358,
|
2358,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user