Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
63b6ec5a
Commit
63b6ec5a
authored
Jun 14, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Nov 24, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Pass a heap block pointer to initialize_block.
parent
1526ac75
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
heap.c
dlls/ntdll/heap.c
+12
-8
No files found.
dlls/ntdll/heap.c
View file @
63b6ec5a
...
...
@@ -378,17 +378,21 @@ static inline void mark_block_tail( struct block *block, DWORD flags )
}
/* initialize contents of a newly created block of memory */
static
inline
void
initialize_block
(
void
*
ptr
,
SIZE_T
size
,
DWORD
flags
)
static
inline
void
initialize_block
(
struct
block
*
block
,
SIZE_T
old_size
,
SIZE_T
size
,
DWORD
flags
)
{
char
*
data
=
(
char
*
)(
block
+
1
);
if
(
size
<=
old_size
)
return
;
if
(
flags
&
HEAP_ZERO_MEMORY
)
{
valgrind_make_writable
(
ptr
,
size
);
memset
(
ptr
,
0
,
size
);
valgrind_make_writable
(
data
+
old_size
,
size
-
old_
size
);
memset
(
data
+
old_size
,
0
,
size
-
old_
size
);
}
else
if
(
flags
&
HEAP_FREE_CHECKING_ENABLED
)
{
valgrind_make_writable
(
ptr
,
size
);
memset
(
ptr
,
BLOCK_FILL_USED
,
size
);
valgrind_make_writable
(
data
+
old_size
,
size
-
old_
size
);
memset
(
data
+
old_size
,
BLOCK_FILL_USED
,
size
-
old_
size
);
}
}
...
...
@@ -845,7 +849,7 @@ static struct block *realloc_large_block( struct heap *heap, DWORD flags, struct
{
/* FIXME: we could remap zero-pages instead */
valgrind_notify_resize
(
data
,
old_size
,
size
);
i
f
(
size
>
old_size
)
initialize_block
(
data
+
old_size
,
size
-
old_
size
,
flags
);
i
nitialize_block
(
block
,
old_size
,
size
,
flags
);
arena
->
data_size
=
size
;
valgrind_make_noaccess
(
(
char
*
)
block
+
sizeof
(
*
block
)
+
arena
->
data_size
,
...
...
@@ -1520,7 +1524,7 @@ static NTSTATUS heap_allocate( struct heap *heap, ULONG flags, SIZE_T block_size
block_set_type
(
block
,
BLOCK_TYPE_USED
);
block_set_flags
(
block
,
~
0
,
BLOCK_USER_FLAGS
(
flags
)
);
shrink_used_block
(
heap
,
flags
,
subheap
,
block
,
old_block_size
,
block_size
,
size
);
initialize_block
(
block
+
1
,
size
,
flags
);
initialize_block
(
block
,
0
,
size
,
flags
);
mark_block_tail
(
block
,
flags
);
*
ret
=
block
+
1
;
...
...
@@ -1646,7 +1650,7 @@ static NTSTATUS heap_reallocate( struct heap *heap, ULONG flags, void *ptr,
block_set_flags
(
block
,
BLOCK_FLAG_USER_MASK
,
BLOCK_USER_FLAGS
(
flags
)
);
shrink_used_block
(
heap
,
flags
,
subheap
,
block
,
old_block_size
,
block_size
,
size
);
i
f
(
size
>
old_size
)
initialize_block
(
(
char
*
)(
block
+
1
)
+
old_size
,
size
-
old_
size
,
flags
);
i
nitialize_block
(
block
,
old_size
,
size
,
flags
);
mark_block_tail
(
block
,
flags
);
*
ret
=
block
+
1
;
...
...
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