Permalink
Browse files

patch 8.0.0340: not checking return valud of dict_add()

Problem:    Not checking return valud of dict_add(). (Coverity)
Solution:   Handle a failure.
  • Loading branch information...
brammool committed Feb 19, 2017
1 parent 46522af commit 5acff71d3bd7796ee0a112ceb891af630b59304e
Showing with 9 additions and 2 deletions.
  1. +7 −2 src/buffer.c
  2. +2 −0 src/version.c
View
@@ -888,8 +888,13 @@ init_changedtick(buf_T *buf)
di->di_tv.v_type = VAR_NUMBER;
di->di_tv.v_lock = VAR_FIXED;
di->di_tv.vval.v_number = 0;
- dict_add(buf->b_vars, di);
- buf->b_changedtick = &di->di_tv.vval.v_number;
+ if (dict_add(buf->b_vars, di) == OK)
+ buf->b_changedtick = &di->di_tv.vval.v_number;
+ else
+ {
+ vim_free(di);
+ buf->b_changedtick = &buf->b_ct_val;
+ }
}
else
#endif
View
@@ -764,6 +764,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 340,
/**/
339,
/**/

0 comments on commit 5acff71

Please sign in to comment.