changeset 31184:6b218e595d9f v9.0.0926

patch 9.0.0926: Coverity warns for not using return value of dict_add() Commit: https://github.com/vim/vim/commit/bc222152d8dea252aa5f1fa24b5536ed269feb92 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Nov 23 11:34:01 2022 +0000 patch 9.0.0926: Coverity warns for not using return value of dict_add() Problem: Coverity warns for not using return value of dict_add(). Solution: When dict_add() fails then don't call hash_remove().
author Bram Moolenaar <Bram@vim.org>
date Wed, 23 Nov 2022 12:45:04 +0100
parents 3efca3371530
children a7543f655304
files src/dict.c src/version.c
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/dict.c
+++ b/src/dict.c
@@ -1122,10 +1122,11 @@ dict_extend(dict_T *d1, dict_T *d2, char
 	    {
 		if (*action == 'm')
 		{
-		    // cheap way to move a dict item from "d2" to "d1"
+		    // Cheap way to move a dict item from "d2" to "d1".
+		    // If dict_add() fails then "d2" won't be empty.
 		    di1 = HI2DI(hi2);
-		    dict_add(d1, di1);
-		    hash_remove(&d2->dv_hashtab, hi2);
+		    if (dict_add(d1, di1) == OK)
+			hash_remove(&d2->dv_hashtab, hi2);
 		}
 		else
 		{
--- 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 */
 /**/
+    926,
+/**/
     925,
 /**/
     924,