{
struct breakpoint *tp;
int any = 0;
- struct cleanup *cleanup;
int extra_trace_bits = 0;
if (filename == 0 || *filename == 0)
return;
}
- filename = tilde_expand (filename);
- cleanup = make_cleanup (xfree, filename);
+ gdb::unique_xmalloc_ptr<char> expanded_filename (tilde_expand (filename));
stdio_file fp;
- if (!fp.open (filename, "w"))
+ if (!fp.open (expanded_filename.get (), "w"))
error (_("Unable to open file '%s' for saving (%s)"),
- filename, safe_strerror (errno));
+ expanded_filename.get (), safe_strerror (errno));
if (extra_trace_bits)
save_trace_state_variables (&fp);
fp.printf ("set default-collect %s\n", default_collect);
if (from_tty)
- printf_filtered (_("Saved to file '%s'.\n"), filename);
- do_cleanups (cleanup);
+ printf_filtered (_("Saved to file '%s'.\n"), expanded_filename.get ());
}
/* The `save breakpoints' command. */