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
9325bfad
Commit
9325bfad
authored
May 04, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
May 19, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use block helpers in subheap_notify_free_all.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2815c117
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
18 deletions
+7
-18
heap.c
dlls/ntdll/heap.c
+7
-18
No files found.
dlls/ntdll/heap.c
View file @
9325bfad
...
...
@@ -383,29 +383,18 @@ static inline void notify_realloc( void const *ptr, SIZE_T size_old, SIZE_T size
#endif
}
static
void
subheap_notify_free_all
(
SUBHEAP
const
*
subheap
)
static
void
notify_free_all
(
SUBHEAP
*
subheap
)
{
#ifdef VALGRIND_FREELIKE_BLOCK
char
const
*
ptr
=
(
char
const
*
)
subheap
->
base
+
subheap
->
headerSize
;
struct
block
*
block
;
if
(
!
RUNNING_ON_VALGRIND
)
return
;
if
(
!
check_subheap
(
subheap
))
return
;
while
(
ptr
<
(
char
const
*
)
subheap
->
base
+
subheap
->
size
)
for
(
block
=
first_block
(
subheap
);
block
;
block
=
next_block
(
subheap
,
block
)
)
{
if
(
*
(
const
DWORD
*
)
ptr
&
ARENA_FLAG_FREE
)
{
ARENA_FREE
const
*
pArena
=
(
ARENA_FREE
const
*
)
ptr
;
if
(
pArena
->
magic
!=
ARENA_FREE_MAGIC
)
ERR
(
"bad free_magic @%p
\n
"
,
pArena
);
ptr
+=
sizeof
(
*
pArena
)
+
(
pArena
->
size
&
ARENA_SIZE_MASK
);
}
else
{
ARENA_INUSE
const
*
pArena
=
(
ARENA_INUSE
const
*
)
ptr
;
if
(
pArena
->
magic
==
ARENA_INUSE_MAGIC
)
notify_free
(
pArena
+
1
);
else
if
(
pArena
->
magic
!=
ARENA_PENDING_MAGIC
)
ERR
(
"bad inuse_magic @%p
\n
"
,
pArena
);
ptr
+=
sizeof
(
*
pArena
)
+
(
pArena
->
size
&
ARENA_SIZE_MASK
);
}
if
(
block_get_flags
(
block
)
&
ARENA_FLAG_FREE
)
continue
;
if
(
block_get_type
(
block
)
==
ARENA_INUSE_MAGIC
)
notify_free
(
block
+
1
);
}
#endif
}
...
...
@@ -1531,13 +1520,13 @@ HANDLE WINAPI RtlDestroyHeap( HANDLE heap )
LIST_FOR_EACH_ENTRY_SAFE
(
subheap
,
next
,
&
heapPtr
->
subheap_list
,
SUBHEAP
,
entry
)
{
if
(
subheap
==
&
heapPtr
->
subheap
)
continue
;
/* do this one last */
subheap_notify_free_all
(
subheap
);
notify_free_all
(
subheap
);
list_remove
(
&
subheap
->
entry
);
size
=
0
;
addr
=
subheap
->
base
;
NtFreeVirtualMemory
(
NtCurrentProcess
(),
&
addr
,
&
size
,
MEM_RELEASE
);
}
subheap_notify_free_all
(
&
heapPtr
->
subheap
);
notify_free_all
(
&
heapPtr
->
subheap
);
RtlFreeHeap
(
GetProcessHeap
(),
0
,
heapPtr
->
pending_free
);
size
=
0
;
addr
=
heapPtr
->
subheap
.
base
;
...
...
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