- free command if it is the empty string
- free command before calling bound function, in case bound function
  does not return, like rl_abort
---
 lib/readline/text.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/readline/text.c b/lib/readline/text.c
index c5281efe..5941b1a2 100644
--- a/lib/readline/text.c
+++ b/lib/readline/text.c
@@ -2354,9 +2354,11 @@ rl_execute_named_command (int count, int key)
   int r;
 
   command = _rl_read_command_name ();
-  if (command == 0 || *command == '\0')
+  if (command == 0)
     return 1;
-  if (func = rl_named_function (command))
+  func = rl_named_function (command);
+  free (command);
+  if (func)
     {
       int prev, ostate;
 
@@ -2375,6 +2377,5 @@ rl_execute_named_command (int count, int key)
       r = 1;
     }
 
-  free (command);
   return r;
 }
-- 
2.45.1


Reply via email to