0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

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().
This commit is contained in:
Bram Moolenaar
2022-11-23 11:34:01 +00:00
parent df3c0eb41e
commit bc222152d8
2 changed files with 6 additions and 3 deletions

View File

@@ -1122,9 +1122,10 @@ dict_extend(dict_T *d1, dict_T *d2, char_u *action, char *func_name)
{ {
if (*action == 'm') 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); di1 = HI2DI(hi2);
dict_add(d1, di1); if (dict_add(d1, di1) == OK)
hash_remove(&d2->dv_hashtab, hi2); hash_remove(&d2->dv_hashtab, hi2);
} }
else else

View File

@@ -695,6 +695,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
926,
/**/ /**/
925, 925,
/**/ /**/