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
69906b59
Commit
69906b59
authored
Aug 20, 2015
by
Henri Verbeet
Committed by
Alexandre Julliard
Aug 20, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d2d1: Properly cleanup in d2d_rectangle_geometry_init() failure paths.
This avoids leaking the factory reference in particular.
parent
5eaf2b51
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
geometry.c
dlls/d2d1/geometry.c
+11
-5
No files found.
dlls/d2d1/geometry.c
View file @
69906b59
...
...
@@ -977,13 +977,12 @@ static BOOL d2d_path_geometry_add_figure(struct d2d_geometry *geometry)
return
TRUE
;
}
static
void
d2d_geometry_
destroy
(
struct
d2d_geometry
*
geometry
)
static
void
d2d_geometry_
cleanup
(
struct
d2d_geometry
*
geometry
)
{
HeapFree
(
GetProcessHeap
(),
0
,
geometry
->
beziers
);
HeapFree
(
GetProcessHeap
(),
0
,
geometry
->
faces
);
HeapFree
(
GetProcessHeap
(),
0
,
geometry
->
vertices
);
ID2D1Factory_Release
(
geometry
->
factory
);
HeapFree
(
GetProcessHeap
(),
0
,
geometry
);
}
static
void
d2d_geometry_init
(
struct
d2d_geometry
*
geometry
,
ID2D1Factory
*
factory
,
...
...
@@ -1363,7 +1362,8 @@ static ULONG STDMETHODCALLTYPE d2d_path_geometry_Release(ID2D1PathGeometry *ifac
if
(
!
refcount
)
{
d2d_path_geometry_free_figures
(
geometry
);
d2d_geometry_destroy
(
geometry
);
d2d_geometry_cleanup
(
geometry
);
HeapFree
(
GetProcessHeap
(),
0
,
geometry
);
}
return
refcount
;
...
...
@@ -1622,7 +1622,10 @@ static ULONG STDMETHODCALLTYPE d2d_rectangle_geometry_Release(ID2D1RectangleGeom
TRACE
(
"%p decreasing refcount to %u.
\n
"
,
iface
,
refcount
);
if
(
!
refcount
)
d2d_geometry_destroy
(
geometry
);
{
d2d_geometry_cleanup
(
geometry
);
HeapFree
(
GetProcessHeap
(),
0
,
geometry
);
}
return
refcount
;
}
...
...
@@ -1792,11 +1795,14 @@ HRESULT d2d_rectangle_geometry_init(struct d2d_geometry *geometry, ID2D1Factory
geometry
->
u
.
rectangle
.
rect
=
*
rect
;
if
(
!
(
geometry
->
vertices
=
HeapAlloc
(
GetProcessHeap
(),
0
,
4
*
sizeof
(
*
geometry
->
vertices
))))
{
d2d_geometry_cleanup
(
geometry
);
return
E_OUTOFMEMORY
;
}
geometry
->
vertex_count
=
4
;
if
(
!
d2d_array_reserve
((
void
**
)
&
geometry
->
faces
,
&
geometry
->
faces_size
,
2
,
sizeof
(
*
geometry
->
faces
)))
{
HeapFree
(
GetProcessHeap
(),
0
,
geometry
->
vertices
);
d2d_geometry_cleanup
(
geometry
);
return
E_OUTOFMEMORY
;
}
geometry
->
face_count
=
2
;
...
...
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