0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 7.4.1156

Problem:    Coverity warns for NULL pointer and ignoring return value.
Solution:   Check for NULL pointer. When dict_add() returns FAIL free the item.
This commit is contained in:
Bram Moolenaar 2016-01-23 21:38:51 +01:00
parent 64922b9014
commit 2dedb45260
2 changed files with 8 additions and 2 deletions

View File

@ -318,7 +318,8 @@ json_decode_object(js_read_T *reader, typval_T *res)
goto fail;
}
di->di_tv = item;
dict_add(res->vval.v_dict, di);
if (dict_add(res->vval.v_dict, di) == FAIL)
dictitem_free(di);
json_skip_white(reader);
p = reader->js_buf + reader->js_used;
@ -398,7 +399,10 @@ json_decode_string(js_read_T *reader, typval_T *res)
{
++reader->js_used;
res->v_type = VAR_STRING;
res->vval.v_string = vim_strsave(ga.ga_data);
if (ga.ga_data == NULL)
res->vval.v_string = NULL;
else
res->vval.v_string = vim_strsave(ga.ga_data);
}
else
{

View File

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