]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix bug, courtesy of Paul Mackerras: when giving find_map_space an address
authorNicholas Nethercote <n.nethercote@gmail.com>
Mon, 23 Aug 2004 09:28:37 +0000 (09:28 +0000)
committerNicholas Nethercote <n.nethercote@gmail.com>
Mon, 23 Aug 2004 09:28:37 +0000 (09:28 +0000)
lower than that of any existing segment, it got it wrong due to the confusing
SkipList API.  I wonder how many more bugs like that there are...?

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2596

coregrind/vg_memory.c

index e21fbfc1447e1b8583d2ce4a7ae87ee3a2f95ffd..483073a22f7632fdb14bd349c4d08da5f2627242 100644 (file)
@@ -514,7 +514,11 @@ Addr VG_(find_map_space)(Addr addr, UInt len, Bool for_client)
       VG_(printf)("find_map_space: ret starts as %p-%p client=%d\n",
                  ret, ret+len, for_client);
 
-   for(s = VG_(SkipList_Find)(&sk_segments, &ret);
+   s = VG_(SkipList_Find)(&sk_segments, &ret);
+   if (s == NULL)
+      s = VG_(SkipNode_First)(&sk_segments);
+
+   for( ;
        s != NULL && s->addr < (ret+len);
        s = VG_(SkipNode_Next)(&sk_segments, s))
    {