https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=7ba2fe4f7d16f5880035e3d4154f72e60df19eea
commit 7ba2fe4f7d16f5880035e3d4154f72e60df19eea
Author: Paul Floyd <pj...@wa...>
Date: Thu Mar 13 20:47:28 2025 +0100
Darwin: close fd after call to ML_(check_macho_and_get_rw_loads)
I missed changing the code so that the VG_(close) happens for all
platforms, not just non-Darwin.
Diff:
---
coregrind/m_debuginfo/debuginfo.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c
index 18fd33535c..cd04720902 100644
--- a/coregrind/m_debuginfo/debuginfo.c
+++ b/coregrind/m_debuginfo/debuginfo.c
@@ -1349,26 +1349,22 @@ ULong VG_(di_notify_mmap)( Addr a, Bool allow_SkFileV, Int use_fd )
expected_rw_load_count = 0;
+ Bool check_ok = False;
#if defined(VGO_darwin)
- if (!ML_(check_macho_and_get_rw_loads)( actual_fd, &expected_rw_load_count ))
- return 0;
-#endif
-
+ check_ok = ML_(check_macho_and_get_rw_loads)( actual_fd, &expected_rw_load_count );
+#else
/* We're only interested in mappings of object files. */
-# if defined(VGO_linux) || defined(VGO_solaris) || defined(VGO_freebsd)
-
- Bool elf_ok = ML_(check_elf_and_get_rw_loads) ( actual_fd, filename, &expected_rw_load_count, use_fd == -1 );
+ check_ok = ML_(check_elf_and_get_rw_loads) ( actual_fd, filename, &expected_rw_load_count, use_fd == -1 );
+#endif
if (use_fd == -1) {
VG_(close)( actual_fd );
}
- if (!elf_ok) {
+ if (!check_ok) {
return 0;
}
-# endif
-
/* See if we have a DebugInfo for this filename. If not,
create one. */
di = find_or_create_DebugInfo_for( filename );
|