diff options
author | Andrew Burgess <aburgess@redhat.com> | 2021-11-08 14:58:46 +0000 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2021-11-16 17:45:45 +0000 |
commit | 8579fd136a614985bd27f20539c7bb7c5a51287d (patch) | |
tree | fb84850409a44e13e832cbadc9025d40c1d33d9f /gdb/location.c | |
parent | 2bb7589ddf61e163f2e414e7033fad56ea17e784 (diff) | |
download | binutils-gdb-8579fd136a614985bd27f20539c7bb7c5a51287d.tar.gz |
gdb/gdbsupport: make xstrprintf and xstrvprintf return a unique_ptr
The motivation is to reduce the number of places where unmanaged
pointers are returned from allocation type routines. All of the
callers are updated.
There should be no user visible changes after this commit.
Diffstat (limited to 'gdb/location.c')
-rw-r--r-- | gdb/location.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gdb/location.c b/gdb/location.c index 1ee20069313..8ec455bd15b 100644 --- a/gdb/location.c +++ b/gdb/location.c @@ -415,9 +415,12 @@ event_location_to_string (struct event_location *location) break; case ADDRESS_LOCATION: - EL_STRING (location) - = xstrprintf ("*%s", - core_addr_to_string (EL_ADDRESS (location))); + { + const char *addr_string + = core_addr_to_string (EL_ADDRESS (location)); + EL_STRING (location) + = xstrprintf ("*%s", addr_string).release (); + } break; case EXPLICIT_LOCATION: |