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
f2a6c169
Commit
f2a6c169
authored
May 21, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
May 23, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use block helpers in create_free_block.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
parent
b4655f24
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
17 deletions
+12
-17
heap.c
dlls/ntdll/heap.c
+12
-17
No files found.
dlls/ntdll/heap.c
View file @
f2a6c169
...
...
@@ -691,45 +691,40 @@ static inline BOOL HEAP_Decommit( SUBHEAP *subheap, void *ptr )
static
void
create_free_block
(
SUBHEAP
*
subheap
,
struct
block
*
block
,
SIZE_T
block_size
)
{
const
char
*
end
=
(
char
*
)
block
+
block_size
,
*
commit_end
=
subheap_commit_end
(
subheap
);
struct
entry
*
entry
=
(
struct
entry
*
)
block
;
HEAP
*
heap
=
subheap
->
heap
;
DWORD
flags
=
heap
->
flags
;
char
*
end
;
BOOL
last
;
struct
block
*
next
;
mark_block_uninitialized
(
block
,
sizeof
(
*
entry
)
);
block_set_type
(
block
,
ARENA_FREE_MAGIC
);
block_set_size
(
block
,
ARENA_FLAG_FREE
,
block_size
);
/* If debugging, erase the freed block content */
end
=
(
char
*
)
block
+
block_size
;
if
(
end
>
(
char
*
)
subheap
->
base
+
subheap
->
commitSize
)
end
=
(
char
*
)
subheap
->
base
+
subheap
->
commitSize
;
if
(
end
>
commit_end
)
end
=
commit_end
;
if
(
end
>
(
char
*
)(
entry
+
1
))
mark_block_free
(
entry
+
1
,
end
-
(
char
*
)(
entry
+
1
),
flags
);
if
(((
char
*
)
block
+
block_size
<
(
char
*
)
subheap
->
base
+
subheap
->
size
)
&&
(
*
(
DWORD
*
)((
char
*
)
block
+
block_size
)
&
ARENA_FLAG_FREE
))
if
((
next
=
next_block
(
subheap
,
block
))
&&
(
block_get_flags
(
next
)
&
ARENA_FLAG_FREE
))
{
/* merge with the next block if it is free */
struct
entry
*
next_entry
=
(
struct
entry
*
)
((
char
*
)
block
+
block_size
)
;
struct
entry
*
next_entry
=
(
struct
entry
*
)
next
;
list_remove
(
&
next_entry
->
entry
);
block_size
+=
(
next_entry
->
size
&
ARENA_SIZE_MASK
)
+
sizeof
(
*
next_entry
);
mark_block_free
(
next_entry
,
sizeof
(
struct
entry
),
flags
);
block_size
+=
block_get_size
(
next
);
block_set_size
(
block
,
ARENA_FLAG_FREE
,
block_size
);
mark_block_free
(
next_entry
,
sizeof
(
*
next_entry
),
flags
);
}
last
=
((
char
*
)
block
+
block_size
>=
(
char
*
)
subheap
->
base
+
subheap
->
size
);
if
(
!
last
)
if
((
next
=
next_block
(
subheap
,
block
)))
{
/* set the next block PREV_FREE flag and back pointer */
DWORD
*
next
=
(
DWORD
*
)((
char
*
)
block
+
block_size
);
*
next
|=
ARENA_FLAG_PREV_FREE
;
block_set_size
(
next
,
ARENA_FLAG_PREV_FREE
,
block_get_size
(
next
)
);
mark_block_initialized
(
(
struct
block
**
)
next
-
1
,
sizeof
(
struct
block
*
)
);
*
((
struct
block
**
)
next
-
1
)
=
block
;
}
entry
->
size
=
(
block_size
-
sizeof
(
*
entry
))
|
ARENA_FLAG_FREE
;
HEAP_InsertFreeBlock
(
subheap
->
heap
,
entry
,
last
);
HEAP_InsertFreeBlock
(
heap
,
entry
,
!
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