[4/4] windows-nat: Use gdb_realpath

Message ID 20240322190424.1231540-5-pedro@palves.net
State New
Headers
Series Down with SO_NAME_MAX_PATH_SIZE and windows_make_so spring cleaning |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 fail Patch failed to apply

Commit Message

Pedro Alves March 22, 2024, 7:04 p.m. UTC
  Use gdb_realpath instead of realpath in windows-nat.c:windows_make_so,
so that we don't have to manually call free.

Change-Id: Id3cda7e177ac984c9a5f7c23f354e72bd561edff
---
 gdb/windows-nat.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
  

Patch

diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 278bfb0e1f1..ee38b985efa 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -891,12 +891,9 @@  windows_make_so (const char *name, LPVOID load_addr)
     }
   else
     {
-      char *rname = realpath (name, NULL);
+      gdb::unique_xmalloc_ptr<char> rname = gdb_realpath (name);
       if (rname != nullptr)
-	{
-	  so->name = rname;
-	  free (rname);
-	}
+	so->name = rname.get ();
       else
 	{
 	  warning (_("dll path for \"%s\" inaccessible"), name);