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
0c5f9e8d
Commit
0c5f9e8d
authored
Nov 25, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Nov 30, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Merge next free block before resizing in heap_reallocate.
parent
c0360db5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
heap.c
dlls/ntdll/heap.c
+8
-5
No files found.
dlls/ntdll/heap.c
View file @
0c5f9e8d
...
...
@@ -1639,7 +1639,10 @@ BOOLEAN WINAPI DECLSPEC_HOTPATCH RtlFreeHeap( HANDLE handle, ULONG flags, void *
static
NTSTATUS
heap_reallocate
(
struct
heap
*
heap
,
ULONG
flags
,
struct
block
*
block
,
SIZE_T
block_size
,
SIZE_T
size
,
void
**
ret
)
{
SUBHEAP
*
subheap
=
block_get_subheap
(
heap
,
block
);
SIZE_T
old_block_size
,
old_size
;
struct
entry
*
entry
;
struct
block
*
next
;
NTSTATUS
status
;
if
(
block_get_flags
(
block
)
&
BLOCK_FLAG_LARGE
)
...
...
@@ -1654,12 +1657,9 @@ static NTSTATUS heap_reallocate( struct heap *heap, ULONG flags, struct block *b
old_block_size
=
block_get_size
(
block
);
old_size
=
old_block_size
-
block_get_overhead
(
block
);
if
(
block_size
>
old_block_size
)
{
SUBHEAP
*
subheap
=
block_get_subheap
(
heap
,
block
);
struct
entry
*
entry
;
struct
block
*
next
;
if
(
!
(
next
=
next_block
(
subheap
,
block
))
||
!
(
block_get_flags
(
next
)
&
BLOCK_FLAG_FREE
)
||
block_size
>=
HEAP_MIN_LARGE_BLOCK_SIZE
||
block_size
>
old_block_size
+
block_get_size
(
next
)
||
!
subheap_commit
(
heap
,
subheap
,
block
,
block_size
))
...
...
@@ -1673,8 +1673,11 @@ static NTSTATUS heap_reallocate( struct heap *heap, ULONG flags, struct block *b
free_used_block
(
heap
,
flags
,
block
);
return
STATUS_SUCCESS
;
}
}
/* The next block is free and large enough */
if
((
next
=
next_block
(
subheap
,
block
))
&&
(
block_get_flags
(
next
)
&
BLOCK_FLAG_FREE
))
{
/* merge with next block if it is free */
entry
=
(
struct
entry
*
)
next
;
list_remove
(
&
entry
->
entry
);
old_block_size
+=
block_get_size
(
next
);
...
...
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