find_pc_partial_function (loc->address, &function_name, NULL, NULL);
if (function_name)
- loc->function_name = xstrdup (function_name);
+ loc->function_name = make_unique_xstrdup (function_name);
}
}
}
}
-bp_location::~bp_location ()
-{
- xfree (function_name);
-}
-
/* Destructor for the breakpoint base class. */
breakpoint::~breakpoint ()
for (l = loc; l != NULL; l = l->next)
{
const char **slot;
- const char *name = l->function_name;
+ const char *name = l->function_name.get ();
/* Allow for some names to be NULL, ignore them. */
if (name == NULL)
{
for (bp_location *l : b->locations ())
if (l->function_name
- && strcmp (e->function_name, l->function_name) == 0)
+ && strcmp (e->function_name.get (),
+ l->function_name.get ()) == 0)
{
l->enabled = e->enabled;
l->disabled_by_cond = e->disabled_by_cond;
/* Construct a bp_location with type TYPE. */
bp_location (breakpoint *owner, bp_loc_type type);
- virtual ~bp_location ();
+ virtual ~bp_location () = default;
/* Chain pointer to the next breakpoint location for
the same parent breakpoint. */
with it. */
bound_probe probe {};
- char *function_name = NULL;
+ gdb::unique_xmalloc_ptr<char> function_name;
/* Details of the placed breakpoint, when inserted. */
bp_target_info target_info {};