aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2020-09-14 11:12:55 -0400
committerSimon Marchi <simon.marchi@efficios.com>2020-09-14 11:30:58 -0400
commit33f4dd48cefa64257880e6d98124c3f3e54f5196 (patch)
treefc9aaf9e4dc34c49468172684d9b33b271a56b56
parent8400a90d19c5c53f7100421c688fb896789048b9 (diff)
downloadfsf-binutils-gdb-33f4dd48cefa64257880e6d98124c3f3e54f5196.zip
fsf-binutils-gdb-33f4dd48cefa64257880e6d98124c3f3e54f5196.tar.gz
fsf-binutils-gdb-33f4dd48cefa64257880e6d98124c3f3e54f5196.tar.bz2
gdb: remove xfree in xml-support.c
Replace an xfree with automatic memory management with a unique pointer. gdb/ChangeLog: * xml-support.c (xml_fetch_content_from_file): Replace xfree with gdb::unique_xmalloc_ptr<char>. Change-Id: Ia4d735b383e3b9eb660f445f2c7f2c5e27411b64
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/xml-support.c6
2 files changed, 8 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8451cad..cbb08c3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2020-09-14 Simon Marchi <simon.marchi@polymtl.ca>
+ * xml-support.c (xml_fetch_content_from_file): Replace xfree
+ with gdb::unique_xmalloc_ptr<char>.
+
+2020-09-14 Simon Marchi <simon.marchi@polymtl.ca>
+
* xml-support.h (xml_fetch_another): Change type to be a
function_view.
(xml_process_xincludes): Remove baton parameter.
diff --git a/gdb/xml-support.c b/gdb/xml-support.c
index 8b698e5..5568c8a 100644
--- a/gdb/xml-support.c
+++ b/gdb/xml-support.c
@@ -969,10 +969,10 @@ xml_fetch_content_from_file (const char *filename, const char *dirname)
if (dirname != nullptr && *dirname != '\0')
{
- char *fullname = concat (dirname, "/", filename, (char *) NULL);
+ gdb::unique_xmalloc_ptr<char> fullname
+ (concat (dirname, "/", filename, (char *) NULL));
- file = gdb_fopen_cloexec (fullname, FOPEN_RB);
- xfree (fullname);
+ file = gdb_fopen_cloexec (fullname.get (), FOPEN_RB);
}
else
file = gdb_fopen_cloexec (filename, FOPEN_RB);