changeset 29574:24f01baa27b2 v9.0.0128

patch 9.0.0128: Coverity complains about possible double free Commit: https://github.com/vim/vim/commit/3f79b61288bf528b9a848af9e4c849c35c1df0bf Author: Bram Moolenaar <Bram@vim.org> Date: Mon Aug 1 12:06:40 2022 +0100 patch 9.0.0128: Coverity complains about possible double free Problem: Coverity complains about possible double free. Solution: Clear the pointer to avoid warnings.
author Bram Moolenaar <Bram@vim.org>
date Mon, 01 Aug 2022 13:15:03 +0200
parents 7ce826240c21
children 3330ed159d90
files src/charset.c src/version.c
diffstat 2 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/charset.c
+++ b/src/charset.c
@@ -912,16 +912,13 @@ init_chartabsize_arg(
 	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
-    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;
@@ -951,7 +948,7 @@ init_chartabsize_arg(
 		if (!cts->cts_has_prop_with_text)
 		{
 		    // won't use the text properties, free them
-		    vim_free(cts->cts_text_props);
+		    VIM_CLEAR(cts->cts_text_props);
 		    cts->cts_text_prop_count = 0;
 		}
 	    }
@@ -969,8 +966,8 @@ clear_chartabsize_arg(chartabsize_T *cts
 #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
+	VIM_CLEAR(cts->cts_text_props);
+	cts->cts_text_prop_count = 0;
     }
 #endif
 }
--- 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 */
 /**/
+    128,
+/**/
     127,
 /**/
     126,