SHA256
3
0
forked from pool/bash
bash/bash-3.2-complete.dif

32 lines
1017 B
Plaintext

--- pcomplete.c
+++ pcomplete.c 2009-01-30 16:59:12.648484782 +0100
@@ -990,7 +990,7 @@ gen_shell_function_matches (cs, text, li
SHELL_VAR *f, *v;
WORD_LIST *cmdlist;
int fval;
- sh_parser_state_t ps;
+ sh_parser_state_t ps, *__restrict__ pps = &ps;
#if defined (ARRAY_VARS)
ARRAY *a;
#endif
@@ -1015,9 +1015,16 @@ gen_shell_function_matches (cs, text, li
cmdlist = build_arg_list (funcname, text, lwords, cw);
- save_parser_state (&ps);
- fval = execute_shell_function (f, cmdlist);
- restore_parser_state (&ps);
+ save_parser_state (pps);
+ begin_unwind_frame ("gen-shell-function-matches");
+ add_unwind_protect (restore_parser_state, (char *)pps);
+ add_unwind_protect (dispose_words, (char *)cmdlist);
+ add_unwind_protect (unbind_compfunc_variables, (char *)0);
+
+ fval = execute_shell_function (f, cmdlist);
+
+ discard_unwind_frame ("gen-shell-function-matches");
+ restore_parser_state (pps);
/* Now clean up and destroy everything. */
dispose_words (cmdlist);