summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-01-23 21:38:51 +0100
committerBram Moolenaar <Bram@vim.org>2016-01-23 21:38:51 +0100
commit2dedb45260604911035cff2364aca90a69156ed9 (patch)
tree209a72a5e113fa9b65ee8dfeb9ab4f0db2ae3997
parent64922b9014765a41bb09e8612433a2a61918af6e (diff)
downloadvim-git-2dedb45260604911035cff2364aca90a69156ed9.tar.gz
patch 7.4.1156v7.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.
-rw-r--r--src/json.c8
-rw-r--r--src/version.c2
2 files changed, 8 insertions, 2 deletions
diff --git a/src/json.c b/src/json.c
index 7b67994dd..442eaff2c 100644
--- a/src/json.c
+++ b/src/json.c
@@ -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
{
diff --git a/src/version.c b/src/version.c
index b909693e5..d646665c9 100644
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1156,
+/**/
1155,
/**/
1154,