From fde841947e445a98f22a04465daa75a9fb6af051 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 10 Dec 2023 07:45:24 -0700 Subject: 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 --- gdb/python/py-breakpoint.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'gdb/python') diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c index 71182cc..5155d41 100644 --- a/gdb/python/py-breakpoint.c +++ b/gdb/python/py-breakpoint.c @@ -1010,12 +1010,12 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs) std::unique_ptr 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 -- cgit v1.1