changeset 35381:063d0ddf5e77 v9.1.0478

patch 9.1.0478: potential deref of NULL pointer in fuzzy_match_str_with_pos Commit: https://github.com/vim/vim/commit/7c57940e3bd883cebb1d73d4b4effa9220d4c4c8 Author: glepnir <glephunter@gmail.com> Date: Wed Jun 12 20:31:13 2024 +0200 patch 9.1.0478: potential deref of NULL pointer in fuzzy_match_str_with_pos Problem: potential deref of NULL pointer in fuzzy_match_str_with_pos() on cleanup (after v9.1.0476) Solution: Only free the pointer if it is non-NULL (glepnir) closes: #14973 Signed-off-by: glepnir <glephunter@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Wed, 12 Jun 2024 20:45:06 +0200
parents fd2ef001b842
children c6d994d8f22a
files src/search.c src/version.c
diffstat 2 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/search.c
+++ b/src/search.c
@@ -5198,11 +5198,16 @@ fuzzy_match_str_with_pos(char_u *str UNU
 
 cleanup:
     vim_free(tv_str.vval.v_string);
-    list_free(match_str_list);
-    list_free(match_pos_list);
-    list_free(match_score_list);
-    list_free(retlist);
-    list_free(l);
+    if (match_str_list != NULL)
+        list_free(match_str_list);
+    if (match_pos_list != NULL)
+        list_free(match_pos_list);
+    if (match_score_list != NULL)
+        list_free(match_score_list);
+    if (retlist != NULL)
+        list_free(retlist);
+    if (l != NULL)
+        list_free(l);
     ga_clear(match_positions);
     return NULL;
 #else
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    478,
+/**/
     477,
 /**/
     476,