diff --git a/reactos/dll/win32/kernel32/include/baseheap.h b/reactos/dll/win32/kernel32/include/baseheap.h index 6342ca0a124..c98900a4286 100644 --- a/reactos/dll/win32/kernel32/include/baseheap.h +++ b/reactos/dll/win32/kernel32/include/baseheap.h @@ -65,6 +65,7 @@ extern RTL_HANDLE_TABLE BaseHeapHandleTable; #define BASE_TRACE_FAILURE() \ BH_PRINT("[BASE_HEAP] %s : Failing %d\n", \ __FUNCTION__, __LINE__) + // // The handle structure for global heap handles. // Notice that it nicely overlays with RTL_HANDLE_ENTRY. diff --git a/reactos/dll/win32/kernel32/mem/global.c b/reactos/dll/win32/kernel32/mem/global.c index 57a2d28ef73..820bd012860 100644 --- a/reactos/dll/win32/kernel32/mem/global.c +++ b/reactos/dll/win32/kernel32/mem/global.c @@ -117,7 +117,7 @@ Quickie: if (!Ptr) { /* We don't have a valid pointer, but so reuse this handle */ - HandleEntry->Flags = BASE_HEAP_ENTRY_FLAG_REUSE; + HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_REUSE; } /* Check if the handle is discardable */ @@ -486,7 +486,7 @@ GlobalReAlloc(HGLOBAL hMem, if (Ptr) { /* Make sure the handle isn't locked */ - if ((uFlags & GMEM_MOVEABLE) & !(HandleEntry->LockCount)) + if ((uFlags & GMEM_MOVEABLE) && !(HandleEntry->LockCount)) { /* Free the current heap */ RtlFreeHeap(hProcessHeap, Flags, Ptr);