From: Orgad Shaneh <orgads@gmail.com>
To: gdb-patches@sourceware.org
Cc: Jon Turney <jon.turney@dronecode.org.uk>
Subject: [PATCH] Better handling for realpath() failures in windows_make_so() on Cygwin
Date: Thu, 21 Mar 2024 09:22:53 +0200 [thread overview]
Message-ID: <20240321072349.1160-1-orgads@gmail.com> (raw)
In-Reply-To: <20240321065417.1125-1-orgad.shaneh@audiocodes.com>
From: Jon Turney <jon.turney@dronecode.org.uk>
Fix a memory leak which would occur in the case when the result of realpath() is
greater than or equal to SO_NAME_MAX_PATH_SIZE.
Distinguish between realpath() failing (returning NULL), and returning a path
longer than SO_NAME_MAX_PATH_SIZE
Warn rather than stopping with an error in those cases.
Original patch from Tim Chick. Memory leak fix by Corinna Vinschen.
---
gdb/windows-nat.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index a90388922e2..29bfad5b060 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -886,13 +886,14 @@ windows_make_so (const char *name, LPVOID load_addr)
if (rname && strlen (rname) < SO_NAME_MAX_PATH_SIZE)
{
so->name = rname;
- free (rname);
}
else
{
warning (_("dll path for \"%s\" too long or inaccessible"), name);
so->name = so->original_name;
}
+ if (rname)
+ free (rname);
}
/* Record cygwin1.dll .text start/end. */
size_t len = sizeof ("/cygwin1.dll") - 1;
--
2.44.0.windows.1.1.g2942425c99
next prev parent reply other threads:[~2024-03-21 7:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-21 6:53 Orgad Shaneh
2024-03-21 7:22 ` Orgad Shaneh [this message]
2024-03-21 15:04 ` Tom Tromey
2024-03-21 14:45 ` Jon Turney
2024-03-21 16:13 ` Pedro Alves
2024-03-21 16:31 ` Orgad Shaneh
2024-03-22 19:07 ` Pedro Alves
-- strict thread matches above, loose matches on Subject: below --
2016-01-20 15:54 Jon Turney
2016-01-20 16:19 ` Pedro Alves
2016-03-09 17:49 ` Jon Turney
2016-03-09 18:09 ` 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=20240321072349.1160-1-orgads@gmail.com \
--to=orgads@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=jon.turney@dronecode.org.uk \
/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