bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] bashline: small leaks


From: Grisha Levit
Subject: [PATCH] bashline: small leaks
Date: Tue, 21 May 2024 11:34:05 -0400

- free directory_part when completing command words like `~/bin/'
- free contents of matches when completing command words in old-style
  command substitutions
---
 bashline.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/bashline.c b/bashline.c
index b638e001..525d065a 100644
--- a/bashline.c
+++ b/bashline.c
@@ -2001,6 +2001,11 @@ command_word_completion_function (const char *hint_text, 
int state)
          free (glob_matches);
          glob_matches = (char **)NULL;
        }
+      if (directory_part)
+        {
+          free (directory_part);
+          directory_part = (char *)NULL;
+        }
 
       globpat = completion_glob_pattern (hint_text);
 
@@ -2451,7 +2456,7 @@ command_subst_completion_function (const char *text, int 
state)
       filename_text = savestring (text);
       if (matches)
        {
-         free (matches);
+         strvec_dispose (matches);
          matches = (char **)NULL;
        }
 
-- 
2.45.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]