Use unique_xmalloc_ptr in explicit_location_spec

This changes explicit_location_spec to use unique_xmalloc_ptr,
removing some manual memory management.

Reviewed-By: John Baldwin <jhb@FreeBSD.org>
This commit is contained in:
Tom Tromey
2023-12-10 07:45:24 -07:00
parent e7cdec6605
commit fde841947e
7 changed files with 83 additions and 81 deletions
+6 -6
View File
@@ -1010,12 +1010,12 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
std::unique_ptr<explicit_location_spec> explicit_loc
(new explicit_location_spec ());
explicit_loc->source_filename
= source != nullptr ? xstrdup (source) : nullptr;
explicit_loc->function_name
= function != nullptr ? xstrdup (function) : nullptr;
explicit_loc->label_name
= label != nullptr ? xstrdup (label) : nullptr;
if (source != nullptr)
explicit_loc->source_filename = make_unique_xstrdup (source);
if (function != nullptr)
explicit_loc->function_name = make_unique_xstrdup (function);
if (label != nullptr)
explicit_loc->label_name = make_unique_xstrdup (label);
if (line != NULL)
explicit_loc->line_offset