bug-bash
[Top][All Lists]
Advanced

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

[PATCH] spell-correct-word: fix small leak


From: Grisha Levit
Subject: [PATCH] spell-correct-word: fix small leak
Date: Tue, 21 May 2024 22:11:35 -0400

Avoid leak when spell-correcting an empty line.
---
 bashline.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/bashline.c b/bashline.c
index 525d065a..528f56e0 100644
--- a/bashline.c
+++ b/bashline.c
@@ -1348,7 +1348,10 @@ bash_spell_correct_shellword (int count, int key)
 
       text = rl_copy_text (wbeg, wend);
       if (text == 0 || *text == 0)
-       break;
+       {
+         FREE (text);
+         break;
+       }
 
       newdir = dirspell (text);
       if (newdir)
-- 
2.45.1




reply via email to

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