Permalink
Browse files

patch 7.4.2361

Problem:    Checking for last_timer_id to overflow is not reliable. (Ozaki
            Kiichi)
Solution:   Check for the number not going up.
  • Loading branch information...
1 parent 80c3fd7 commit ee39ef0b93d31763d05e54ba99801e3f1a254c0d @brammool brammool committed Sep 10, 2016
Showing with 4 additions and 1 deletion.
  1. +2 −1 src/ex_cmds2.c
  2. +2 −0 src/version.c
View
@@ -1143,10 +1143,11 @@ free_timer(timer_T *timer)
create_timer(long msec, int repeat)
{
timer_T *timer = (timer_T *)alloc_clear(sizeof(timer_T));
+ long prev_id = last_timer_id;
if (timer == NULL)
return NULL;
- if (++last_timer_id < 0)
+ if (++last_timer_id <= prev_id)
/* Overflow! Might cause duplicates... */
last_timer_id = 0;
timer->tr_id = last_timer_id;
View
@@ -764,6 +764,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2361,
+/**/
2360,
/**/
2359,

0 comments on commit ee39ef0

Please sign in to comment.