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]

Re: [RFA 4/8] Make strip_bg_char return a unique_xmalloc_ptr


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_cleanups
here.  However, I am not sure how to detect that.

-- 
Yao (齐尧)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]