changeset 30194:16f2cc81a5c1 v9.0.0433

patch 9.0.0433: Coverity warns for not checking allocation failure Commit: https://github.com/vim/vim/commit/12553ada3b1ceee0179527abc9980b8392fd6c7e Author: Bram Moolenaar <Bram@vim.org> Date: Sat Sep 10 10:42:20 2022 +0100 patch 9.0.0433: Coverity warns for not checking allocation failure Problem: Coverity warns for not checking allocation failure. Solution: Check that allocating a list or blob succeeded.
author Bram Moolenaar <Bram@vim.org>
date Sat, 10 Sep 2022 11:45:04 +0200
parents 96f0c360721d
children a7a66422cded
files src/eval.c src/version.c
diffstat 2 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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)
 	{
--- 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,