From a8a7c763fdc5057684234feef94796ef9886aba8 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 7 Dec 2021 21:51:03 -0700 Subject: [PATCH] Fix bug in source.c change My earlier change to source.c ("Remove an xfree from add_path") introduced a regression. This patch fixes the problem. --- gdb/source.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gdb/source.c b/gdb/source.c index d91389e28b7..f28c30628e6 100644 --- a/gdb/source.c +++ b/gdb/source.c @@ -660,8 +660,8 @@ add_path (const char *dirname, char **which_path, int parse_separators) more. */ if (prefix) { - std::string temp (old, prefix); - *which_path = concat (temp.c_str (), tinybuf, name, &old[prefix], + std::string temp = std::string (old, prefix) + tinybuf + name; + *which_path = concat (temp.c_str (), &old[prefix], (char *) nullptr); prefix = temp.length (); } -- 2.30.2