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
da5903e7
Commit
da5903e7
authored
Apr 20, 2020
by
Nikolay Sivov
Committed by
Alexandre Julliard
Apr 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Improve locking safety in IMalloc::Free().
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ed531275
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
22 deletions
+26
-22
ifs.c
dlls/ole32/ifs.c
+26
-22
No files found.
dlls/ole32/ifs.c
View file @
da5903e7
...
...
@@ -254,35 +254,39 @@ static void * WINAPI IMalloc_fnRealloc(IMalloc *iface, void *pv, SIZE_T cb)
/******************************************************************************
* IMalloc32_Free [VTABLE]
*/
static
void
WINAPI
IMalloc_fnFree
(
IMalloc
*
iface
,
void
*
pv
)
static
void
WINAPI
IMalloc_fnFree
(
IMalloc
*
iface
,
void
*
mem
)
{
BOOL
fSpyed
=
FALSE
;
TRACE
(
"(%p)
\n
"
,
pv
);
if
(
!
pv
)
return
;
BOOL
spyed_block
=
FALSE
,
spy_active
=
FALSE
;
if
(
Malloc32
.
pSpy
)
{
EnterCriticalSection
(
&
IMalloc32_SpyCS
);
fSpyed
=
mallocspy_remove_spyed_memory
(
pv
);
pv
=
IMallocSpy_PreFree
(
Malloc32
.
pSpy
,
pv
,
fSpyed
);
}
TRACE
(
"(%p)
\n
"
,
mem
);
HeapFree
(
GetProcessHeap
(),
0
,
pv
);
if
(
!
mem
)
return
;
if
(
Malloc32
.
pSpy
)
{
IMallocSpy_PostFree
(
Malloc32
.
pSpy
,
fSpyed
);
if
(
Malloc32
.
pSpy
)
{
EnterCriticalSection
(
&
IMalloc32_SpyCS
);
spyed_block
=
mallocspy_remove_spyed_memory
(
mem
);
spy_active
=
TRUE
;
mem
=
IMallocSpy_PreFree
(
Malloc32
.
pSpy
,
mem
,
spyed_block
);
}
/* check if can release the spy */
if
(
Malloc32
.
SpyReleasePending
&&
!
Malloc32
.
SpyedAllocationsLeft
)
{
IMallocSpy_Release
(
Malloc32
.
pSpy
);
Malloc32
.
SpyReleasePending
=
FALSE
;
Malloc32
.
pSpy
=
NULL
;
}
HeapFree
(
GetProcessHeap
(),
0
,
mem
);
LeaveCriticalSection
(
&
IMalloc32_SpyCS
);
if
(
spy_active
)
{
IMallocSpy_PostFree
(
Malloc32
.
pSpy
,
spyed_block
);
/* check if can release the spy */
if
(
Malloc32
.
SpyReleasePending
&&
!
Malloc32
.
SpyedAllocationsLeft
)
{
IMallocSpy_Release
(
Malloc32
.
pSpy
);
Malloc32
.
SpyReleasePending
=
FALSE
;
Malloc32
.
pSpy
=
NULL
;
}
LeaveCriticalSection
(
&
IMalloc32_SpyCS
);
}
}
/******************************************************************************
...
...
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