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
9326fc13
Commit
9326fc13
authored
Sep 30, 2010
by
Vincent Povirk
Committed by
Alexandre Julliard
Oct 01, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdiplus: Don't try to free invalid or already-freed images.
parent
daa9d700
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
2 deletions
+32
-2
image.c
dlls/gdiplus/image.c
+8
-2
image.c
dlls/gdiplus/tests/image.c
+24
-0
No files found.
dlls/gdiplus/image.c
View file @
9326fc13
...
...
@@ -1958,8 +1958,6 @@ GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
if
(
!
image
)
return
InvalidParameter
;
if
(
image
->
picture
)
IPicture_Release
(
image
->
picture
);
if
(
image
->
type
==
ImageTypeBitmap
)
{
GdipFree
(((
GpBitmap
*
)
image
)
->
bitmapbits
);
...
...
@@ -1967,7 +1965,15 @@ GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
DeleteDC
(((
GpBitmap
*
)
image
)
->
hdc
);
DeleteObject
(((
GpBitmap
*
)
image
)
->
hbitmap
);
}
else
if
(
image
->
type
!=
ImageTypeMetafile
)
{
WARN
(
"invalid image: %p
\n
"
,
image
);
return
ObjectBusy
;
}
if
(
image
->
picture
)
IPicture_Release
(
image
->
picture
);
GdipFree
(
image
->
palette_entries
);
image
->
type
=
~
0
;
GdipFree
(
image
);
return
Ok
;
...
...
dlls/gdiplus/tests/image.c
View file @
9326fc13
...
...
@@ -2250,6 +2250,29 @@ static void test_colorkey(void)
GdipDisposeImageAttributes
(
imageattr
);
}
static
void
test_dispose
(
void
)
{
GpStatus
stat
;
GpImage
*
image
;
char
invalid_image
[
256
];
stat
=
GdipDisposeImage
(
NULL
);
expect
(
InvalidParameter
,
stat
);
stat
=
GdipCreateBitmapFromScan0
(
2
,
2
,
0
,
PixelFormat32bppARGB
,
NULL
,
(
GpBitmap
**
)
&
image
);
expect
(
Ok
,
stat
);
stat
=
GdipDisposeImage
(
image
);
expect
(
Ok
,
stat
);
stat
=
GdipDisposeImage
(
image
);
expect
(
ObjectBusy
,
stat
);
memset
(
invalid_image
,
0
,
256
);
stat
=
GdipDisposeImage
((
GpImage
*
)
invalid_image
);
expect
(
ObjectBusy
,
stat
);
}
START_TEST
(
image
)
{
struct
GdiplusStartupInput
gdiplusStartupInput
;
...
...
@@ -2289,6 +2312,7 @@ START_TEST(image)
test_rotateflip
();
test_remaptable
();
test_colorkey
();
test_dispose
();
GdiplusShutdown
(
gdiplusToken
);
}
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