Patch 9.0.0128

5 views
Skip to first unread message

Bram Moolenaar

unread,
Aug 1, 2022, 7:57:09 AM8/1/22
to vim...@googlegroups.com

Patch 9.0.0128
Problem: Coverity complains about possible double free.
Solution: Clear the pointer to avoid warnings.
Files: src/charset.c


*** ../vim-9.0.0127/src/charset.c 2022-08-01 11:17:36.757985327 +0100
--- src/charset.c 2022-08-01 12:06:06.778321007 +0100
***************
*** 912,927 ****
char_u *line,
char_u *ptr)
{
cts->cts_win = wp;
cts->cts_lnum = lnum;
cts->cts_vcol = col;
cts->cts_line = line;
cts->cts_ptr = ptr;
#ifdef FEAT_PROP_POPUP
- cts->cts_text_prop_count = 0;
- cts->cts_has_prop_with_text = FALSE;
- cts->cts_cur_text_width = 0;
- cts->cts_with_trailing = 0;
if (lnum > 0)
{
char_u *prop_start;
--- 912,924 ----
char_u *line,
char_u *ptr)
{
+ CLEAR_POINTER(cts);
cts->cts_win = wp;
cts->cts_lnum = lnum;
cts->cts_vcol = col;
cts->cts_line = line;
cts->cts_ptr = ptr;
#ifdef FEAT_PROP_POPUP
if (lnum > 0)
{
char_u *prop_start;
***************
*** 951,957 ****
if (!cts->cts_has_prop_with_text)
{
// won't use the text properties, free them
! vim_free(cts->cts_text_props);
cts->cts_text_prop_count = 0;
}
}
--- 948,954 ----
if (!cts->cts_has_prop_with_text)
{
// won't use the text properties, free them
! VIM_CLEAR(cts->cts_text_props);
cts->cts_text_prop_count = 0;
}
}
***************
*** 969,976 ****
#ifdef FEAT_PROP_POPUP
if (cts->cts_text_prop_count > 0)
{
! vim_free(cts->cts_text_props);
! cts->cts_text_prop_count = 0; // avoid double free
}
#endif
}
--- 966,973 ----
#ifdef FEAT_PROP_POPUP
if (cts->cts_text_prop_count > 0)
{
! VIM_CLEAR(cts->cts_text_props);
! cts->cts_text_prop_count = 0;
}
#endif
}
*** ../vim-9.0.0127/src/version.c 2022-08-01 11:49:41.218734039 +0100
--- src/version.c 2022-08-01 12:05:20.394664637 +0100
***************
*** 737,738 ****
--- 737,740 ----
{ /* Add new patch number below this line */
+ /**/
+ 128,
/**/

--
Don't be humble ... you're not that great.
-- Golda Meir

/// 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