From 25499151ed99faeb4bcbd3f7e02f8f2ab117b92f Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Thu, 27 Jul 2006 23:12:17 +0000 Subject: [PATCH] When doing leak checks, don't poke around in device segments as this may hang the entire machine. (Tom Hughes). git-svn-id: svn://svn.valgrind.org/valgrind/trunk@5990 --- memcheck/mc_leakcheck.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/memcheck/mc_leakcheck.c b/memcheck/mc_leakcheck.c index 3f921cc7d..8d30713b3 100644 --- a/memcheck/mc_leakcheck.c +++ b/memcheck/mc_leakcheck.c @@ -763,6 +763,21 @@ void MC_(do_detect_memory_leaks) ( continue; if (seg->isCH) continue; + + /* Don't poke around in device segments as this may cause + hangs. Exclude /dev/zero just in case someone allocated + memory by explicitly mapping /dev/zero. */ + if (seg->kind == SkFileC + && (VKI_S_ISCHR(seg->mode) || VKI_S_ISBLK(seg->mode))) { + HChar* dev_name = VG_(am_get_filename)( seg ); + if (dev_name && 0 == VG_(strcmp)(dev_name, "/dev/zero")) { + /* don't skip /dev/zero */ + } else { + /* skip this device mapping */ + continue; + } + } + if (0) VG_(printf)("ACCEPT %2d %p %p\n", i, seg->start, seg->end); lc_scan_memory(seg->start, seg->end+1 - seg->start);