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
+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
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);