Skip to content

Commit 3336fb8

Browse files
committed
Cygwin: Don't increment DLL reference count in dladdr.
Unlike GetModuleHandle, GetModuleHandleEx increments the reference count by default unless the GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT flag is passed. Fixes: c8432a0 ("Implement dladdr() (partially)") Addresses: https://cygwin.com/pipermail/cygwin/2025-April/257864.html Signed-off-by: Jeremy Drake <[email protected]> (cherry picked from commit 97f9ef3)
1 parent e0bd8b4 commit 3336fb8

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

winsup/cygwin/dlfcn.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,8 @@ extern "C" int
408408
dladdr (const void *addr, Dl_info *info)
409409
{
410410
HMODULE hModule;
411-
BOOL ret = GetModuleHandleEx (GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
411+
BOOL ret = GetModuleHandleEx (GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT|
412+
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
412413
(LPCSTR) addr,
413414
&hModule);
414415
if (!ret)

winsup/cygwin/release/3.6.1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,6 @@ Fixes:
3636
subprocess failure in cmake (>= 3.29.x).
3737
Addresses: https://cygwin.com/pipermail/cygwin/2025-March/257800.html
3838
Addresses: https://github.com/msys2/msys2-runtime/issues/272
39+
40+
- Don't increment DLL reference count in dladdr.
41+
Addresses: https://cygwin.com/pipermail/cygwin/2025-April/257862.html

0 commit comments

Comments
 (0)