]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Darwin: close fd after call to ML_(check_macho_and_get_rw_loads)
authorPaul Floyd <pjfloyd@wanadoo.fr>
Thu, 13 Mar 2025 19:47:28 +0000 (20:47 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Thu, 13 Mar 2025 19:47:28 +0000 (20:47 +0100)
I missed changing the code so that the VG_(close) happens for all
platforms, not just non-Darwin.

coregrind/m_debuginfo/debuginfo.c

index 18fd33535c0fa1f3d61273120e39833c36f8ab37..cd047209022c54efeb1d232f565149aae68774fd 100644 (file)
@@ -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 );