From 33f4dd48cefa64257880e6d98124c3f3e54f5196 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Mon, 14 Sep 2020 11:12:55 -0400 Subject: [PATCH] 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. Change-Id: Ia4d735b383e3b9eb660f445f2c7f2c5e27411b64 --- gdb/ChangeLog | 5 +++++ gdb/xml-support.c | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8451cadcd5b..cbb08c3e9a9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2020-09-14 Simon Marchi + + * xml-support.c (xml_fetch_content_from_file): Replace xfree + with gdb::unique_xmalloc_ptr. + 2020-09-14 Simon Marchi * xml-support.h (xml_fetch_another): Change type to be a diff --git a/gdb/xml-support.c b/gdb/xml-support.c index 8b698e511f1..5568c8a74ec 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 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); -- 2.30.2