diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-07-26 11:20:48 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-07-26 11:20:48 +0100 |
commit | 34a1f779791fd4137547fa72addeb147b7704604 (patch) | |
tree | 95659a79c49440884bd0cf40b9146923886a95af /src | |
parent | 1b67f07f7626b87d9ce3e16815970988983a2ddc (diff) |
patch 9.0.0074: Coverity warns for double freev9.0.0074
Problem: Coverity warns for double free.
Solution: Reset cts_text_prop_count when freeing cts_text_props.
Diffstat (limited to 'src')
-rw-r--r-- | src/charset.c | 3 | ||||
-rw-r--r-- | src/structs.h | 7 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 9 insertions, 3 deletions
diff --git a/src/charset.c b/src/charset.c index 8c6ac1c2f4..f41248bd63 100644 --- a/src/charset.c +++ b/src/charset.c @@ -964,7 +964,10 @@ clear_chartabsize_arg(chartabsize_T *cts UNUSED) { #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 } diff --git a/src/structs.h b/src/structs.h index 1d2aa0a8e2..d5276724d8 100644 --- a/src/structs.h +++ b/src/structs.h @@ -4570,9 +4570,10 @@ typedef struct { 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_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 diff --git a/src/version.c b/src/version.c index 6d7aede80c..f7cbaf81bd 100644 --- a/src/version.c +++ b/src/version.c @@ -736,6 +736,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 74, +/**/ 73, /**/ 72, |