diff options
author | Tom Tromey <tom@tromey.com> | 2023-12-10 07:45:24 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2023-12-13 14:12:52 -0700 |
commit | fde841947e445a98f22a04465daa75a9fb6af051 (patch) | |
tree | f95774d5b6c4e560ee50c593ffd3241f8e0519bc /gdb/python | |
parent | e7cdec6605837a5b79442fc06bd66d6372025040 (diff) | |
download | gdb-fde841947e445a98f22a04465daa75a9fb6af051.zip gdb-fde841947e445a98f22a04465daa75a9fb6af051.tar.gz gdb-fde841947e445a98f22a04465daa75a9fb6af051.tar.bz2 |
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>
Diffstat (limited to 'gdb/python')
-rw-r--r-- | gdb/python/py-breakpoint.c | 12 |
1 files changed, 6 insertions, 6 deletions
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_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 |