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
6715b186
Commit
6715b186
authored
Sep 21, 2012
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Sep 21, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowscodecs: Avoid unnecessary memory allocations.
parent
0b40c9cb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
12 deletions
+7
-12
gifformat.c
dlls/windowscodecs/gifformat.c
+7
-12
No files found.
dlls/windowscodecs/gifformat.c
View file @
6715b186
...
@@ -413,10 +413,7 @@ static HRESULT load_APE_metadata(IStream *stream, const GUID *vendor, DWORD opti
...
@@ -413,10 +413,7 @@ static HRESULT load_APE_metadata(IStream *stream, const GUID *vendor, DWORD opti
result
[
1
].
id
.
u
.
pwszVal
=
strdupAtoW
(
"Data"
);
result
[
1
].
id
.
u
.
pwszVal
=
strdupAtoW
(
"Data"
);
result
[
1
].
value
.
vt
=
VT_UI1
|
VT_VECTOR
;
result
[
1
].
value
.
vt
=
VT_UI1
|
VT_VECTOR
;
result
[
1
].
value
.
u
.
caub
.
cElems
=
data_size
;
result
[
1
].
value
.
u
.
caub
.
cElems
=
data_size
;
result
[
1
].
value
.
u
.
caub
.
pElems
=
HeapAlloc
(
GetProcessHeap
(),
0
,
data_size
);
result
[
1
].
value
.
u
.
caub
.
pElems
=
data
;
memcpy
(
result
[
1
].
value
.
u
.
caub
.
pElems
,
data
,
data_size
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
*
items
=
result
;
*
items
=
result
;
*
count
=
2
;
*
count
=
2
;
...
@@ -449,7 +446,7 @@ static HRESULT load_GifComment_metadata(IStream *stream, const GUID *vendor, DWO
...
@@ -449,7 +446,7 @@ static HRESULT load_GifComment_metadata(IStream *stream, const GUID *vendor, DWO
ULONG
bytesread
,
data_size
;
ULONG
bytesread
,
data_size
;
MetadataItem
*
result
;
MetadataItem
*
result
;
BYTE
subblock_size
;
BYTE
subblock_size
;
BYTE
*
data
;
char
*
data
;
*
items
=
NULL
;
*
items
=
NULL
;
*
count
=
0
;
*
count
=
0
;
...
@@ -474,10 +471,10 @@ static HRESULT load_GifComment_metadata(IStream *stream, const GUID *vendor, DWO
...
@@ -474,10 +471,10 @@ static HRESULT load_GifComment_metadata(IStream *stream, const GUID *vendor, DWO
if
(
!
subblock_size
)
break
;
if
(
!
subblock_size
)
break
;
if
(
!
data
)
if
(
!
data
)
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
subblock_size
);
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
subblock_size
+
1
);
else
else
{
{
BYTE
*
new_data
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
data
,
data_size
+
subblock_size
);
char
*
new_data
=
HeapReAlloc
(
GetProcessHeap
(),
0
,
data
,
data_size
+
subblock_size
+
1
);
if
(
!
new_data
)
if
(
!
new_data
)
{
{
HeapFree
(
GetProcessHeap
(),
0
,
data
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
...
@@ -494,6 +491,8 @@ static HRESULT load_GifComment_metadata(IStream *stream, const GUID *vendor, DWO
...
@@ -494,6 +491,8 @@ static HRESULT load_GifComment_metadata(IStream *stream, const GUID *vendor, DWO
data_size
+=
subblock_size
;
data_size
+=
subblock_size
;
}
}
data
[
data_size
]
=
0
;
result
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
MetadataItem
));
result
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
MetadataItem
));
if
(
!
result
)
if
(
!
result
)
{
{
...
@@ -508,11 +507,7 @@ static HRESULT load_GifComment_metadata(IStream *stream, const GUID *vendor, DWO
...
@@ -508,11 +507,7 @@ static HRESULT load_GifComment_metadata(IStream *stream, const GUID *vendor, DWO
result
->
id
.
vt
=
VT_LPWSTR
;
result
->
id
.
vt
=
VT_LPWSTR
;
result
->
id
.
u
.
pwszVal
=
strdupAtoW
(
"TextEntry"
);
result
->
id
.
u
.
pwszVal
=
strdupAtoW
(
"TextEntry"
);
result
->
value
.
vt
=
VT_LPSTR
;
result
->
value
.
vt
=
VT_LPSTR
;
result
->
value
.
u
.
pszVal
=
HeapAlloc
(
GetProcessHeap
(),
0
,
data_size
+
1
);
result
->
value
.
u
.
pszVal
=
data
;
memcpy
(
result
->
value
.
u
.
pszVal
,
data
,
data_size
);
result
->
value
.
u
.
pszVal
[
data_size
]
=
0
;
HeapFree
(
GetProcessHeap
(),
0
,
data
);
*
items
=
result
;
*
items
=
result
;
*
count
=
1
;
*
count
=
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