changeset 31768:3f0f639eed9a v9.0.1216

patch 9.0.1216: Coverity warns for ignoring return value Commit: https://github.com/vim/vim/commit/64f1c4152e939ca41d57d5b4376be522736ba22a Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jan 18 12:45:30 2023 +0000 patch 9.0.1216: Coverity warns for ignoring return value Problem: Coverity warns for ignoring return value. Solution: Break out of loop if function fails.
author Bram Moolenaar <Bram@vim.org>
date Wed, 18 Jan 2023 14:00:09 +0100
parents 29e0a0f7160f
children a169126bf2a3
files src/mbyte.c src/version.c
diffstat 2 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -5756,11 +5756,14 @@ f_getcellwidths(typval_T *argvars UNUSED
 	list_T *entry = list_alloc();
 	if (entry == NULL)
 	    break;
-	list_append_number(entry, (varnumber_T)cw_table[i].first);
-	list_append_number(entry, (varnumber_T)cw_table[i].last);
-	list_append_number(entry, (varnumber_T)cw_table[i].width);
-
-	list_append_list(rettv->vval.v_list, entry);
+	if (list_append_number(entry, (varnumber_T)cw_table[i].first) == FAIL
+	   || list_append_number(entry, (varnumber_T)cw_table[i].last) == FAIL
+	   || list_append_number(entry, (varnumber_T)cw_table[i].width) == FAIL
+	   || list_append_list(rettv->vval.v_list, entry) == FAIL)
+	{
+	    list_free(entry);
+	    break;
+	}
     }
 }
 
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1216,
+/**/
     1215,
 /**/
     1214,