sim: move -Werror disabling to Makefile
[binutils-gdb.git] / gdb / xml-support.c
index 8b698e511f12c572f79528c909b01545ef21ab34..5ba1e53bf928b72fc3a03d18840f12844551faf6 100644 (file)
@@ -1,6 +1,6 @@
 /* Helper routines for parsing XML using Expat.
 
-   Copyright (C) 2006-2020 Free Software Foundation, Inc.
+   Copyright (C) 2006-2021 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -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);