]> granicus.if.org Git - vim/commitdiff
patch 9.0.0926: Coverity warns for not using return value of dict_add() v9.0.0926
authorBram Moolenaar <Bram@vim.org>
Wed, 23 Nov 2022 11:34:01 +0000 (11:34 +0000)
committerBram Moolenaar <Bram@vim.org>
Wed, 23 Nov 2022 11:34:01 +0000 (11:34 +0000)
Problem:    Coverity warns for not using return value of dict_add().
Solution:   When dict_add() fails then don't call hash_remove().

src/dict.c
src/version.c

index 30264a913447b93f92664fb3ccdca5dee0331bad..ffd5d381ec822a82c847796152817eccf6142859 100644 (file)
@@ -1122,10 +1122,11 @@ dict_extend(dict_T *d1, dict_T *d2, char_u *action, char *func_name)
            {
                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
                {
index 6ccc704d489522b2e6ca53a7bd2e55fbf038660f..c9e3a2ef6b42f21d871362c568507c7824fafdc1 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    926,
 /**/
     925,
 /**/