Return unique_xmalloc_ptr from gdbscm_safe_eval_string
This changes gdbscm_safe_eval_string to return a unique_xmalloc_ptr. This allows for the removal of some cleanups. It also fixes a potential latent memory leak in gdbscm_set_backtrace. gdb/ChangeLog 2018-07-17 Tom Tromey <tom@tromey.com> * guile/guile.c (gdbscm_eval_from_control_command): Update. * guile/guile-internal.h (gdbscm_safe_eval_string): Update. * guile/scm-objfile.c (gdbscm_execute_objfile_script): Update. * guile/scm-safe-call.c (gdbscm_safe_eval_string): Return unique_xmalloc_ptr.
This commit is contained in:
parent
15bf30027b
commit
a1a31cb8dc
5 changed files with 21 additions and 29 deletions
|
@ -336,16 +336,12 @@ gdbscm_execute_objfile_script (const struct extension_language_defn *extlang,
|
|||
struct objfile *objfile, const char *name,
|
||||
const char *script)
|
||||
{
|
||||
char *msg;
|
||||
|
||||
ofscm_current_objfile = objfile;
|
||||
|
||||
msg = gdbscm_safe_eval_string (script, 0 /* display_result */);
|
||||
gdb::unique_xmalloc_ptr<char> msg
|
||||
= gdbscm_safe_eval_string (script, 0 /* display_result */);
|
||||
if (msg != NULL)
|
||||
{
|
||||
fprintf_filtered (gdb_stderr, "%s", msg);
|
||||
xfree (msg);
|
||||
}
|
||||
fprintf_filtered (gdb_stderr, "%s", msg.get ());
|
||||
|
||||
ofscm_current_objfile = NULL;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue