Patch 9.0.0926

3 views
Skip to first unread message

Bram Moolenaar

unread,
Nov 23, 2022, 6:34:40 AM11/23/22
to vim...@googlegroups.com

Patch 9.0.0926
Problem: Coverity warns for not using return value of dict_add().
Solution: When dict_add() fails then don't call hash_remove().
Files: src/dict.c


*** ../vim-9.0.0925/src/dict.c 2022-11-22 12:40:44.066427878 +0000
--- src/dict.c 2022-11-23 11:29:52.442448895 +0000
***************
*** 1122,1131 ****
{
if (*action == 'm')
{
! // cheap way to move a dict item from "d2" to "d1"
di1 = HI2DI(hi2);
! dict_add(d1, di1);
! hash_remove(&d2->dv_hashtab, hi2);
}
else
{
--- 1122,1132 ----
{
if (*action == 'm')
{
! // Cheap way to move a dict item from "d2" to "d1".
! // If dict_add() fails then "d2" won't be empty.
di1 = HI2DI(hi2);
! if (dict_add(d1, di1) == OK)
! hash_remove(&d2->dv_hashtab, hi2);
}
else
{
*** ../vim-9.0.0925/src/version.c 2022-11-23 11:23:14.539539089 +0000
--- src/version.c 2022-11-23 11:31:36.826252869 +0000
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 926,
/**/

--
Amnesia is one of my favorite words, but I forgot what it means.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages