From: Rémi Bernon rbernon@codeweavers.com
Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/kernelbase/memory.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/kernelbase/memory.c b/dlls/kernelbase/memory.c index 416d7b52a16..b89ab04a38f 100644 --- a/dlls/kernelbase/memory.c +++ b/dlls/kernelbase/memory.c @@ -712,7 +712,7 @@ static struct kernelbase_global_data global_data = {0};
static inline struct mem_entry *unsafe_mem_from_HLOCAL( HLOCAL handle ) { - struct mem_entry *mem = CONTAINING_RECORD( handle, struct mem_entry, ptr ); + struct mem_entry *mem = CONTAINING_RECORD( *(volatile HANDLE *)&handle, struct mem_entry, ptr ); struct kernelbase_global_data *data = &global_data; if (((UINT_PTR)handle & ((sizeof(void *) << 1) - 1)) != sizeof(void *)) return NULL; if (mem < data->mem_entries || mem >= data->mem_entries_end) return NULL; @@ -831,7 +831,7 @@ HLOCAL WINAPI DECLSPEC_HOTPATCH LocalAlloc( UINT flags, SIZE_T size ) return handle;
failed: - if (mem) LocalFree( handle ); + if (mem) LocalFree( *(volatile HANDLE *)&handle ); SetLastError( ERROR_NOT_ENOUGH_MEMORY ); return 0; }