Skip to content

Commit

Permalink
patch 9.0.0926: Coverity warns for not using return value of dict_add()
Browse files Browse the repository at this point in the history
Problem:    Coverity warns for not using return value of dict_add().
Solution:   When dict_add() fails then don't call hash_remove().
  • Loading branch information
brammool committed Nov 23, 2022
1 parent df3c0eb commit bc22215
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/dict.c
Expand Up @@ -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
{
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -695,6 +695,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
926,
/**/
925,
/**/
Expand Down

0 comments on commit bc22215

Please sign in to comment.