Mikołaj Zalewski : kernel: Fix clearing of memory in LocalReAlloc16(..., LMEM_ZEROMEMORY).
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Jun 4 08:14:25 CDT 2007
Module: wine
Branch: master
Commit: 2e5a48be43c4fcfea1a5ca1f8dec437b9bad9a27
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2e5a48be43c4fcfea1a5ca1f8dec437b9bad9a27
Author: Mikołaj Zalewski <mikolaj at zalewski.pl>
Date: Sat Jun 2 21:31:28 2007 +0200
kernel: Fix clearing of memory in LocalReAlloc16(..., LMEM_ZEROMEMORY).
---
dlls/kernel32/local16.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/dlls/kernel32/local16.c b/dlls/kernel32/local16.c
index 76b2a6d..87f11ed 100644
--- a/dlls/kernel32/local16.c
+++ b/dlls/kernel32/local16.c
@@ -1331,7 +1331,12 @@ HLOCAL16 WINAPI LocalReAlloc16( HLOCAL16 handle, WORD size, UINT16 flags )
TRACE("size increase, making new free block\n");
LOCAL_GrowArenaUpward(ds, arena, nextarena - arena);
if (flags & LMEM_ZEROINIT)
- memset((char *)pArena + oldsize, 0, size - oldsize);
+ {
+ char *oldend = (char *)pArena + ARENA_HEADER_SIZE + oldsize;
+ char *newend = ptr + pArena->next;
+ TRACE("Clearing memory from %p to %p (DS -> %p)\n", oldend, newend, ptr);
+ memset(oldend, 0, newend - oldend);
+ }
TRACE("returning %04x\n", handle );
return handle;
More information about the wine-cvs
mailing list