Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
03ad9474
Commit
03ad9474
authored
Nov 19, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Nov 22, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Only discard HLOCAL with LMEM_MOVEABLE and if not locked.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=53474
parent
28bc3b07
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
16 deletions
+6
-16
heap.c
dlls/kernel32/tests/heap.c
+4
-14
memory.c
dlls/kernelbase/memory.c
+2
-2
No files found.
dlls/kernel32/tests/heap.c
View file @
03ad9474
...
...
@@ -1948,7 +1948,7 @@ static void test_GlobalAlloc(void)
tmp_mem
=
GlobalReAlloc
(
mem
,
0
,
flags
);
if
(
flags
==
GMEM_FIXED
)
todo_wine
ok
(
!
tmp_mem
,
"GlobalReAlloc succeeded
\n
"
);
ok
(
!
tmp_mem
,
"GlobalReAlloc succeeded
\n
"
);
else
if
(
!
(
flags
&
GMEM_MODIFY
)
&&
(
flags
&
GMEM_DISCARDABLE
))
ok
(
!
tmp_mem
,
"GlobalReAlloc succeeded
\n
"
);
else
...
...
@@ -1960,13 +1960,11 @@ static void test_GlobalAlloc(void)
expect_entry
.
ptr
=
NULL
;
}
else
if
((
flags
&
GMEM_DISCARDABLE
)
&&
(
flags
&
GMEM_MODIFY
))
expect_entry
.
flags
|=
4
;
todo_wine_if
(
!
flags
)
ok
(
entry
.
ptr
==
expect_entry
.
ptr
,
"got ptr %p was %p
\n
"
,
entry
.
ptr
,
expect_entry
.
ptr
);
todo_wine_if
(
!
flags
)
ok
(
entry
.
flags
==
expect_entry
.
flags
,
"got flags %#Ix was %#Ix
\n
"
,
entry
.
flags
,
expect_entry
.
flags
);
size
=
GlobalSize
(
mem
);
if
(
flags
==
GMEM_MOVEABLE
)
ok
(
size
==
0
,
"GlobalSize returned %Iu
\n
"
,
size
);
else
todo_wine_if
(
!
flags
)
ok
(
size
==
12
,
"GlobalSize returned %Iu
\n
"
,
size
);
else
ok
(
size
==
12
,
"GlobalSize returned %Iu
\n
"
,
size
);
mem
=
GlobalFree
(
mem
);
ok
(
!
mem
,
"GlobalFree failed, error %lu
\n
"
,
GetLastError
()
);
...
...
@@ -2502,18 +2500,12 @@ static void test_LocalAlloc(void)
if
(
flags
&
LMEM_MODIFY
)
ok
(
tmp_mem
==
mem
,
"LocalReAlloc returned %p, error %lu
\n
"
,
tmp_mem
,
GetLastError
()
);
else
{
todo_wine_if
(
flags
==
LMEM_FIXED
||
flags
==
LMEM_MOVEABLE
)
ok
(
!
tmp_mem
,
"LocalReAlloc succeeded
\n
"
);
}
entry
=
*
mem_entry_from_HANDLE
(
mem
);
if
((
flags
&
LMEM_DISCARDABLE
)
&&
(
flags
&
LMEM_MODIFY
))
expect_entry
.
flags
|=
4
;
todo_wine_if
(
flags
==
LMEM_FIXED
||
flags
==
LMEM_MOVEABLE
)
ok
(
entry
.
ptr
==
expect_entry
.
ptr
,
"got ptr %p was %p
\n
"
,
entry
.
ptr
,
expect_entry
.
ptr
);
todo_wine_if
(
flags
==
LMEM_FIXED
||
flags
==
LMEM_MOVEABLE
)
ok
(
entry
.
flags
==
expect_entry
.
flags
,
"got flags %#Ix was %#Ix
\n
"
,
entry
.
flags
,
expect_entry
.
flags
);
size
=
LocalSize
(
mem
);
todo_wine_if
(
flags
==
LMEM_FIXED
||
flags
==
LMEM_MOVEABLE
)
ok
(
size
==
12
,
"LocalSize returned %Iu
\n
"
,
size
);
ret
=
LocalUnlock
(
mem
);
...
...
@@ -2580,7 +2572,7 @@ static void test_LocalAlloc(void)
tmp_mem
=
LocalReAlloc
(
mem
,
0
,
flags
);
if
(
flags
==
LMEM_FIXED
)
todo_wine
ok
(
!
tmp_mem
,
"LocalReAlloc succeeded
\n
"
);
ok
(
!
tmp_mem
,
"LocalReAlloc succeeded
\n
"
);
else
if
(
!
(
flags
&
LMEM_MODIFY
)
&&
(
flags
&
LMEM_DISCARDABLE
))
ok
(
!
tmp_mem
,
"LocalReAlloc succeeded
\n
"
);
else
...
...
@@ -2592,13 +2584,11 @@ static void test_LocalAlloc(void)
expect_entry
.
ptr
=
NULL
;
}
else
if
((
flags
&
LMEM_DISCARDABLE
)
&&
(
flags
&
LMEM_MODIFY
))
expect_entry
.
flags
|=
4
;
todo_wine_if
(
!
flags
)
ok
(
entry
.
ptr
==
expect_entry
.
ptr
,
"got ptr %p was %p
\n
"
,
entry
.
ptr
,
expect_entry
.
ptr
);
todo_wine_if
(
!
flags
)
ok
(
entry
.
flags
==
expect_entry
.
flags
,
"got flags %#Ix was %#Ix
\n
"
,
entry
.
flags
,
expect_entry
.
flags
);
size
=
LocalSize
(
mem
);
if
(
flags
==
LMEM_MOVEABLE
)
ok
(
size
==
0
,
"LocalSize returned %Iu
\n
"
,
size
);
else
todo_wine_if
(
!
(
flags
&
(
LMEM_MODIFY
|
LMEM_DISCARDABLE
)))
ok
(
size
==
12
,
"LocalSize returned %Iu
\n
"
,
size
);
else
ok
(
size
==
12
,
"LocalSize returned %Iu
\n
"
,
size
);
mem
=
LocalFree
(
mem
);
ok
(
!
mem
,
"LocalFree failed, error %lu
\n
"
,
GetLastError
()
);
...
...
dlls/kernelbase/memory.c
View file @
03ad9474
...
...
@@ -1024,14 +1024,14 @@ HLOCAL WINAPI DECLSPEC_HOTPATCH LocalReAlloc( HLOCAL handle, SIZE_T size, UINT f
ret
=
handle
;
}
}
else
else
if
((
flags
&
LMEM_MOVEABLE
)
&&
!
mem
->
lock
)
{
HeapFree
(
heap
,
heap_flags
,
mem
->
ptr
);
mem
->
flags
|=
MEM_FLAG_DISCARDED
;
mem
->
lock
=
0
;
mem
->
ptr
=
NULL
;
ret
=
handle
;
}
else
SetLastError
(
ERROR_INVALID_PARAMETER
);
}
}
else
SetLastError
(
ERROR_INVALID_HANDLE
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment