The comment describing why this wasn't done has been there since the
start of the repo's history and AFAICT it is not accurate anymore, as
shell_execve only calls realloc when it's going to longjmp rather than
return.
Fixes leak in
bash -O execfail -c 'exec /; :'
---
builtins/exec.def | 4 ----
1 file changed, 4 deletions(-)
diff --git a/builtins/exec.def b/builtins/exec.def
index 3ca7c4f8..618882c8 100644
--- a/builtins/exec.def
+++ b/builtins/exec.def
@@ -230,10 +230,6 @@ exec_builtin (WORD_LIST *list)
exit_value = shell_execve (command, args, env);
opt = errno;
- /* We have to set this to NULL because shell_execve has called realloc()
- to stuff more items at the front of the array, which may have caused
- the memory to be freed by realloc(). We don't want to free it twice. */
- args = (char **)NULL;
if (cleanenv == 0)
adjust_shell_level (1);
--
2.45.1