diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-09-10 10:42:20 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-09-10 10:42:20 +0100 |
commit | 12553ada3b1ceee0179527abc9980b8392fd6c7e (patch) | |
tree | 9c040e68860c5828a5d36efb73fb9f3744c56865 | |
parent | 6de2296e5e696b894576d48239aaab0ae84486ff (diff) | |
download | vim-git-12553ada3b1ceee0179527abc9980b8392fd6c7e.tar.gz |
patch 9.0.0433: Coverity warns for not checking allocation failurev9.0.0433
Problem: Coverity warns for not checking allocation failure.
Solution: Check that allocating a list or blob succeeded.
-rw-r--r-- | src/eval.c | 10 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/eval.c b/src/eval.c index 989147381..d69abb017 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1121,6 +1121,8 @@ get_lval( var2.v_type = VAR_UNKNOWN; while (*p == '[' || (*p == '.' && p[1] != '=' && p[1] != '.')) { + int r; + if (*p == '.' && lp->ll_tv->v_type != VAR_DICT) { if (!quiet) @@ -1136,12 +1138,14 @@ get_lval( return NULL; } - // a NULL list/blob works like an empty list/blob, allocate one now. + // A NULL list/blob works like an empty list/blob, allocate one now. if (lp->ll_tv->v_type == VAR_LIST && lp->ll_tv->vval.v_list == NULL) - rettv_list_alloc(lp->ll_tv); + r = rettv_list_alloc(lp->ll_tv); else if (lp->ll_tv->v_type == VAR_BLOB && lp->ll_tv->vval.v_blob == NULL) - rettv_blob_alloc(lp->ll_tv); + r = rettv_blob_alloc(lp->ll_tv); + if (r == FAIL) + return NULL; if (lp->ll_range) { diff --git a/src/version.c b/src/version.c index 3c7c9c82d..51478ad6e 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 433, +/**/ 432, /**/ 431, |