This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On 2017-10-16 05:33, Yao Qi wrote:
Tom Tromey <tom@tromey.com> writes:- args = strip_bg_char (args, &async_exec); - args_chain = make_cleanup (xfree, args);+ gdb::unique_xmalloc_ptr<char> stripped = strip_bg_char (args, &async_exec);+ args = stripped.get (); /* Do validation and preparation before possibly changing anything in the inferior. */@@ -663,9 +663,6 @@ run_command_1 (char *args, int from_tty, enum run_how run_how)uiout->flush (); } - /* Done with ARGS. */ - do_cleanups (args_chain); -My concern is that we may leak something if some cleanups are registered to the cleanup chain in the callees between make_cleanup and do_cleanupshere. However, I am not sure how to detect that.
When reviewing previous cleanup-removal patches, I tried to look for something that hinted like it would install and return a cleanup, but it's obviously not a 100% reliable method. What you could do is temporarily add
struct cleanup *before = cleanup_chain; at the beginning of the function, and gdb_assert (cleanup_chain == before); at the end. Simon
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |