Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: gdb-patches@sourceware.org
Subject: [PATCH 4/4] windows-nat: Use gdb_realpath
Date: Fri, 22 Mar 2024 19:04:24 +0000	[thread overview]
Message-ID: <20240322190424.1231540-5-pedro@palves.net> (raw)
In-Reply-To: <20240322190424.1231540-1-pedro@palves.net>

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(-)

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


  parent reply	other threads:[~2024-03-22 19:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-22 19:04 [PATCH 0/4] Down with SO_NAME_MAX_PATH_SIZE and windows_make_so spring cleaning Pedro Alves
2024-03-22 19:04 ` [PATCH 1/4] Remove SO_NAME_MAX_PATH_SIZE limit from core solib code Pedro Alves
2024-03-22 19:04 ` [PATCH 2/4] Simplify windows-nat.c:windows_make_so #ifdefery Pedro Alves
2024-03-22 19:04 ` [PATCH 3/4] windows-nat: Remove SO_NAME_MAX_PATH_SIZE limit Pedro Alves
2024-03-22 19:04 ` Pedro Alves [this message]
2024-03-22 19:37 ` [PATCH 0/4] Down with SO_NAME_MAX_PATH_SIZE and windows_make_so spring cleaning John Baldwin
2024-03-22 19:49   ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240322190424.1231540-5-pedro@palves.net \
    --to=pedro@palves.net \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox