Patch 9.0.0074

3 views
Skip to first unread message

Bram Moolenaar

unread,
Jul 26, 2022, 6:21:31 AM7/26/22
to vim...@googlegroups.com

Patch 9.0.0074
Problem: Coverity warns for double free.
Solution: Reset cts_text_prop_count when freeing cts_text_props.
Files: src/charset.c, src/structs.h


*** ../vim-9.0.0073/src/charset.c 2022-07-25 18:35:11.998814206 +0100
--- src/charset.c 2022-07-26 11:17:24.977380367 +0100
***************
*** 964,970 ****
--- 964,973 ----
{
#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
}

*** ../vim-9.0.0073/src/structs.h 2022-07-25 18:13:33.054580717 +0100
--- src/structs.h 2022-07-26 11:18:30.597001769 +0100
***************
*** 4570,4578 ****
char_u *cts_line; // start of the line
char_u *cts_ptr; // current position in line
#ifdef FEAT_PROP_POPUP
! int cts_text_prop_count; // number of text props
! textprop_T *cts_text_props; // text props (allocated) or NULL
! char cts_has_prop_with_text; // TRUE if if a property inserts text
int cts_cur_text_width; // width of current inserted text
#endif
int cts_vcol; // virtual column at current position
--- 4570,4579 ----
char_u *cts_line; // start of the line
char_u *cts_ptr; // current position in line
#ifdef FEAT_PROP_POPUP
! int cts_text_prop_count; // number of text props; when zero
! // cts_text_props is not used
! textprop_T *cts_text_props; // text props (allocated)
! char cts_has_prop_with_text; // TRUE if if a property inserts text
int cts_cur_text_width; // width of current inserted text
#endif
int cts_vcol; // virtual column at current position
*** ../vim-9.0.0073/src/version.c 2022-07-25 21:40:03.173430713 +0100
--- src/version.c 2022-07-26 11:16:31.405705463 +0100
***************
*** 737,738 ****
--- 737,740 ----
{ /* Add new patch number below this line */
+ /**/
+ 74,
/**/

--
You cannot have a baby in one month by getting nine women pregnant.

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