MSYS2-packages/gdb/0003-Better-handling-for-realpath-failures-in-windows_mak.patch
2024-03-03 10:25:00 +02:00

38 lines
1.1 KiB
Diff

From fe506e4b6be96a1128db4e516f8b57d08767c4cd Mon Sep 17 00:00:00 2001
From: Jon Turney <jon.turney@dronecode.org.uk>
Date: Wed, 13 Jan 2016 18:27:48 +0000
Subject: [PATCH 3/6] Better handling for realpath() failures in
windows_make_so() on Cygwin
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 | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 40229478b6f..d46de87f238 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -894,6 +894,10 @@ windows_make_so (const char *name, LPVOID load_addr)
{
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. */
--
2.44.0.windows.1