The codes after is_pointer(hmem) function, "if (hmem == NULL)" check is needed to avoid null-pointer dereferences. After struggling about 1 week, I found the C code "*p|=0", and if this p is NULL, NULL-pointer error will occur.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49155 Signed-off-by: Gen Otsuji otsugen0000@gmail.com --- dlls/kernelbase/memory.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/dlls/kernelbase/memory.c b/dlls/kernelbase/memory.c index 1efc3b6e82..5744193a74 100644 --- a/dlls/kernelbase/memory.c +++ b/dlls/kernelbase/memory.c @@ -641,6 +641,9 @@ HLOCAL WINAPI DECLSPEC_HOTPATCH LocalFree( HLOCAL hmem ) ret = 0; if (is_pointer(hmem)) /* POINTER */ { + if (hmem == NULL) + ret = NULL; + else if (!HeapFree( GetProcessHeap(), HEAP_NO_SERIALIZE, hmem )) { SetLastError( ERROR_INVALID_HANDLE ); @@ -690,6 +693,7 @@ LPVOID WINAPI DECLSPEC_HOTPATCH LocalLock( HLOCAL hmem )
if (is_pointer( hmem )) { + if (hmem == NULL) return NULL; __TRY { volatile char *p = hmem;