0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.0.0340: not checking return valud of dict_add()

Problem:    Not checking return valud of dict_add(). (Coverity)
Solution:   Handle a failure.
This commit is contained in:
Bram Moolenaar
2017-02-19 13:55:02 +01:00
parent 46522af724
commit 5acff71d3b
2 changed files with 9 additions and 2 deletions

View File

@@ -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);
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 File

@@ -764,6 +764,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
340,
/**/
339,
/**/