summaryrefslogtreecommitdiff
path: root/gdb/linespec.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2022-01-14 07:24:18 -0700
committerTom Tromey <tom@tromey.com>2022-01-18 10:00:00 -0700
commitdab863ef408588aba1c396901e3e5070948d2047 (patch)
tree9ce96ef1d6d47d125ba54fd3d235f4d41d2eb281 /gdb/linespec.c
parente53c95d40b128a1e794b27ec8b166ae1445356eb (diff)
downloadbinutils-gdb-dab863ef408588aba1c396901e3e5070948d2047.tar.gz
Remove a use of xfree in location.c
This small cleanup removes a use of xfree from location.c, by switching to unique_xmalloc_ptr. One function is only used in location.c, so it is made static. And, another function is changed to avoid a copy.
Diffstat (limited to 'gdb/linespec.c')
-rw-r--r--gdb/linespec.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/gdb/linespec.c b/gdb/linespec.c
index eb911ccdb35..b24cf30dc71 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -2098,12 +2098,8 @@ canonicalize_linespec (struct linespec_state *state, const linespec *ls)
/* If this location originally came from a linespec, save a string
representation of it for display and saving to file. */
if (state->is_linespec)
- {
- char *linespec = explicit_location_to_linespec (explicit_loc);
-
- set_event_location_string (canon, linespec);
- xfree (linespec);
- }
+ set_event_location_string (canon,
+ explicit_location_to_linespec (explicit_loc));
}
/* Given a line offset in LS, construct the relevant SALs. */