Hi Joerg,
Op 21-02-11 12:26, joerg-cyril.hoe...@t-systems.com schreef:
Hi,
I used to run Valgrind with the additional options
--malloc-fill=A5 --free-fill=DE
around Wine 1.2 times. Now I retried it and it crashes
Wine 1.3.13 and 1.3.14 (it fails to load kernel32.dll).
It turns out that malloc-fill is harmless, -free-fill causes havoc currently.
Am I the only one using or seeing this (Ubuntu Lucid)?
It's most likely a valgrind/wine bug, does this patch work?
Cheers,
Maarten
>From 344c2234deb65b514bf9f10b5e894bde7c49976c Mon Sep 17 00:00:00 2001
From: Maarten Lankhorst <m.b.lankho...@gmail.com>
Date: Fri, 26 Nov 2010 00:03:40 +0100
Subject: [PATCH 08/24] ntdll: HACK to prevent valgrind --free-fill error
---
dlls/ntdll/heap.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c
index df94410..933d998 100644
--- a/dlls/ntdll/heap.c
+++ b/dlls/ntdll/heap.c
@@ -747,7 +747,7 @@ static void *realloc_large_block( HEAP *heap, DWORD flags,
void *ptr, SIZE_T siz
ARENA_LARGE *arena = (ARENA_LARGE *)ptr - 1;
void *new_ptr;
- if (arena->block_size - sizeof(*arena) >= size)
+ if (arena->block_size - sizeof(*arena) >= size && !RUNNING_ON_VALGRIND)
{
SIZE_T unused = arena->block_size - sizeof(*arena) - size;
@@ -1820,7 +1820,7 @@ PVOID WINAPI RtlReAllocateHeap( HANDLE heap, ULONG flags,
PVOID ptr, SIZE_T size
oldBlockSize = (pArena->size & ARENA_SIZE_MASK);
oldActualSize = (pArena->size & ARENA_SIZE_MASK) - pArena->unused_bytes;
- if (rounded_size > oldBlockSize)
+ if (rounded_size > oldBlockSize || RUNNING_ON_VALGRIND)
{
char *pNext = (char *)(pArena + 1) + oldBlockSize;
@@ -1835,7 +1835,8 @@ PVOID WINAPI RtlReAllocateHeap( HANDLE heap, ULONG flags,
PVOID ptr, SIZE_T size
}
if ((pNext < (char *)subheap->base + subheap->size) &&
(*(DWORD *)pNext & ARENA_FLAG_FREE) &&
- (oldBlockSize + (*(DWORD *)pNext & ARENA_SIZE_MASK) +
sizeof(ARENA_FREE) >= rounded_size))
+ (oldBlockSize + (*(DWORD *)pNext & ARENA_SIZE_MASK) +
sizeof(ARENA_FREE) >= rounded_size) &&
+ !RUNNING_ON_VALGRIND)
{
/* The next block is free and large enough */
ARENA_FREE *pFree = (ARENA_FREE *)pNext;
--
1.7.2.3