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
7d2bd1e4
Commit
7d2bd1e4
authored
Aug 18, 2023
by
Alex Henrie
Committed by
Alexandre Julliard
Aug 21, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowscodecs: Use CRT allocation functions.
parent
7d013ed8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
277 additions
and
308 deletions
+277
-308
bitmap.c
dlls/windowscodecs/bitmap.c
+8
-8
bmpdecode.c
dlls/windowscodecs/bmpdecode.c
+14
-14
bmpencode.c
dlls/windowscodecs/bmpencode.c
+6
-6
clipper.c
dlls/windowscodecs/clipper.c
+2
-2
clsfactory.c
dlls/windowscodecs/clsfactory.c
+2
-2
colorcontext.c
dlls/windowscodecs/colorcontext.c
+9
-9
colortransform.c
dlls/windowscodecs/colortransform.c
+2
-2
converter.c
dlls/windowscodecs/converter.c
+0
-0
ddsformat.c
dlls/windowscodecs/ddsformat.c
+12
-12
decoder.c
dlls/windowscodecs/decoder.c
+7
-7
encoder.c
dlls/windowscodecs/encoder.c
+5
-5
fliprotate.c
dlls/windowscodecs/fliprotate.c
+2
-2
gifformat.c
dlls/windowscodecs/gifformat.c
+16
-16
icoformat.c
dlls/windowscodecs/icoformat.c
+10
-10
imgfactory.c
dlls/windowscodecs/imgfactory.c
+4
-4
info.c
dlls/windowscodecs/info.c
+38
-39
libjpeg.c
dlls/windowscodecs/libjpeg.c
+4
-4
libpng.c
dlls/windowscodecs/libpng.c
+8
-9
libtiff.c
dlls/windowscodecs/libtiff.c
+6
-6
metadatahandler.c
dlls/windowscodecs/metadatahandler.c
+14
-14
palette.c
dlls/windowscodecs/palette.c
+22
-22
pngformat.c
dlls/windowscodecs/pngformat.c
+23
-23
propertybag.c
dlls/windowscodecs/propertybag.c
+6
-6
scaler.c
dlls/windowscodecs/scaler.c
+8
-8
stream.c
dlls/windowscodecs/stream.c
+8
-8
tgaformat.c
dlls/windowscodecs/tgaformat.c
+7
-7
ungif.c
dlls/windowscodecs/ungif.c
+30
-59
wincodecs_common.c
dlls/windowscodecs/wincodecs_common.c
+2
-2
wincodecs_common.h
dlls/windowscodecs/wincodecs_common.h
+2
-2
No files found.
dlls/windowscodecs/bitmap.c
View file @
7d2bd1e4
...
...
@@ -162,7 +162,7 @@ static ULONG WINAPI BitmapLockImpl_Release(IWICBitmapLock *iface)
{
BitmapImpl_ReleaseLock
(
This
->
parent
);
IWICBitmap_Release
(
&
This
->
parent
->
IWICBitmap_iface
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -287,8 +287,8 @@ static ULONG WINAPI BitmapImpl_Release(IWICBitmap *iface)
if
(
This
->
view
)
UnmapViewOfFile
(
This
->
view
);
else
HeapFree
(
GetProcessHeap
(),
0
,
This
->
data
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
->
data
);
free
(
This
);
}
return
ref
;
...
...
@@ -392,13 +392,13 @@ static HRESULT WINAPI BitmapImpl_Lock(IWICBitmap *iface, const WICRect *prcLock,
return
E_FAIL
;
}
result
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
BitmapLockImpl
));
result
=
malloc
(
sizeof
(
BitmapLockImpl
));
if
(
!
result
)
return
E_OUTOFMEMORY
;
if
(
!
BitmapImpl_AcquireLock
(
This
,
flags
&
WICBitmapLockWrite
))
{
HeapFree
(
GetProcessHeap
(),
0
,
result
);
free
(
result
);
return
WINCODEC_ERR_ALREADYLOCKED
;
}
...
...
@@ -798,13 +798,13 @@ HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight, UINT stride, UINT datasiz
if
(
datasize
<
stride
*
uiHeight
)
return
WINCODEC_ERR_INSUFFICIENTBUFFER
;
if
(
stride
<
((
bpp
*
uiWidth
)
+
7
)
/
8
)
return
E_INVALIDARG
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
BitmapImpl
));
This
=
malloc
(
sizeof
(
BitmapImpl
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
if
(
view
)
data
=
(
BYTE
*
)
view
+
offset
;
else
if
(
!
(
data
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
datasize
)))
else
if
(
!
(
data
=
calloc
(
1
,
datasize
)))
{
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
return
E_OUTOFMEMORY
;
}
...
...
dlls/windowscodecs/bmpdecode.c
View file @
7d2bd1e4
...
...
@@ -224,9 +224,9 @@ static HRESULT WINAPI BmpFrameDecode_CopyPalette(IWICBitmapFrameDecode *iface,
int
i
;
count
=
1
<<
bch
->
bcBitCount
;
wiccolors
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WICColor
)
*
count
);
wiccolors
=
malloc
(
sizeof
(
WICColor
)
*
count
);
tablesize
=
sizeof
(
RGBTRIPLE
)
*
count
;
bgrcolors
=
HeapAlloc
(
GetProcessHeap
(),
0
,
tablesize
);
bgrcolors
=
malloc
(
tablesize
);
if
(
!
wiccolors
||
!
bgrcolors
)
{
hr
=
E_OUTOFMEMORY
;
...
...
@@ -272,7 +272,7 @@ static HRESULT WINAPI BmpFrameDecode_CopyPalette(IWICBitmapFrameDecode *iface,
count
=
min
(
This
->
bih
.
bV5ClrUsed
,
1
<<
This
->
bih
.
bV5BitCount
);
tablesize
=
sizeof
(
WICColor
)
*
count
;
wiccolors
=
HeapAlloc
(
GetProcessHeap
(),
0
,
tablesize
);
wiccolors
=
malloc
(
tablesize
);
if
(
!
wiccolors
)
{
hr
=
E_OUTOFMEMORY
;
...
...
@@ -308,8 +308,8 @@ end:
if
(
SUCCEEDED
(
hr
))
hr
=
IWICPalette_InitializeCustom
(
pIPalette
,
wiccolors
,
count
);
HeapFree
(
GetProcessHeap
(),
0
,
wiccolors
);
HeapFree
(
GetProcessHeap
(),
0
,
bgrcolors
);
free
(
wiccolors
);
free
(
bgrcolors
);
return
hr
;
}
...
...
@@ -386,7 +386,7 @@ static HRESULT BmpFrameDecode_ReadUncompressed(BmpDecoder* This)
bytesperrow
=
(((
width
*
This
->
bitsperpixel
)
+
31
)
/
32
)
*
4
;
datasize
=
bytesperrow
*
height
;
This
->
imagedata
=
HeapAlloc
(
GetProcessHeap
(),
0
,
datasize
);
This
->
imagedata
=
malloc
(
datasize
);
if
(
!
This
->
imagedata
)
return
E_OUTOFMEMORY
;
offbits
.
QuadPart
=
This
->
image_offset
;
...
...
@@ -409,7 +409,7 @@ static HRESULT BmpFrameDecode_ReadUncompressed(BmpDecoder* This)
return
S_OK
;
fail:
HeapFree
(
GetProcessHeap
(),
0
,
This
->
imagedata
);
free
(
This
->
imagedata
);
This
->
imagedata
=
NULL
;
if
(
SUCCEEDED
(
hr
))
hr
=
E_FAIL
;
return
hr
;
...
...
@@ -480,7 +480,7 @@ static HRESULT BmpFrameDecode_ReadRLE8(BmpDecoder* This)
else
palettesize
=
4
*
256
;
This
->
imagedata
=
HeapAlloc
(
GetProcessHeap
(),
0
,
datasize
);
This
->
imagedata
=
malloc
(
datasize
);
if
(
!
This
->
imagedata
)
{
hr
=
E_OUTOFMEMORY
;
...
...
@@ -576,7 +576,7 @@ end:
return
S_OK
;
fail:
HeapFree
(
GetProcessHeap
(),
0
,
This
->
imagedata
);
free
(
This
->
imagedata
);
This
->
imagedata
=
NULL
;
if
(
SUCCEEDED
(
hr
))
hr
=
E_FAIL
;
return
hr
;
...
...
@@ -604,7 +604,7 @@ static HRESULT BmpFrameDecode_ReadRLE4(BmpDecoder* This)
else
palettesize
=
4
*
16
;
This
->
imagedata
=
HeapAlloc
(
GetProcessHeap
(),
0
,
datasize
);
This
->
imagedata
=
malloc
(
datasize
);
if
(
!
This
->
imagedata
)
{
hr
=
E_OUTOFMEMORY
;
...
...
@@ -716,7 +716,7 @@ end:
return
S_OK
;
fail:
HeapFree
(
GetProcessHeap
(),
0
,
This
->
imagedata
);
free
(
This
->
imagedata
);
This
->
imagedata
=
NULL
;
if
(
SUCCEEDED
(
hr
))
hr
=
E_FAIL
;
return
hr
;
...
...
@@ -1011,10 +1011,10 @@ static ULONG WINAPI BmpDecoder_Release(IWICBitmapDecoder *iface)
if
(
ref
==
0
)
{
if
(
This
->
stream
)
IStream_Release
(
This
->
stream
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
imagedata
);
free
(
This
->
imagedata
);
This
->
lock
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
This
->
lock
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -1152,7 +1152,7 @@ static HRESULT BmpDecoder_Create(int packed, int icoframe, BmpDecoder **ppDecode
{
BmpDecoder
*
This
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
BmpDecoder
));
This
=
malloc
(
sizeof
(
BmpDecoder
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
IWICBitmapDecoder_iface
.
lpVtbl
=
&
BmpDecoder_Vtbl
;
...
...
dlls/windowscodecs/bmpencode.c
View file @
7d2bd1e4
...
...
@@ -125,8 +125,8 @@ static ULONG WINAPI BmpFrameEncode_Release(IWICBitmapFrameEncode *iface)
if
(
ref
==
0
)
{
if
(
This
->
stream
)
IStream_Release
(
This
->
stream
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
bits
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
->
bits
);
free
(
This
);
}
return
ref
;
...
...
@@ -249,7 +249,7 @@ static HRESULT BmpFrameEncode_AllocateBits(BmpFrameEncode *This)
return
WINCODEC_ERR_WRONGSTATE
;
This
->
stride
=
(((
This
->
width
*
This
->
format
->
bpp
)
+
31
)
/
32
)
*
4
;
This
->
bits
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
This
->
stride
*
This
->
height
);
This
->
bits
=
calloc
(
This
->
stride
,
This
->
height
);
if
(
!
This
->
bits
)
return
E_OUTOFMEMORY
;
}
...
...
@@ -482,7 +482,7 @@ static ULONG WINAPI BmpEncoder_Release(IWICBitmapEncoder *iface)
{
if
(
This
->
stream
)
IStream_Release
(
This
->
stream
);
if
(
This
->
frame
)
IWICBitmapFrameEncode_Release
(
&
This
->
frame
->
IWICBitmapFrameEncode_iface
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -581,7 +581,7 @@ static HRESULT WINAPI BmpEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
if
(
FAILED
(
hr
))
return
hr
;
}
encode
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
BmpFrameEncode
));
encode
=
malloc
(
sizeof
(
BmpFrameEncode
));
if
(
!
encode
)
{
IPropertyBag2_Release
(
*
ppIEncoderOptions
);
...
...
@@ -651,7 +651,7 @@ HRESULT BmpEncoder_CreateInstance(REFIID iid, void** ppv)
*
ppv
=
NULL
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
BmpEncoder
));
This
=
malloc
(
sizeof
(
BmpEncoder
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
IWICBitmapEncoder_iface
.
lpVtbl
=
&
BmpEncoder_Vtbl
;
...
...
dlls/windowscodecs/clipper.c
View file @
7d2bd1e4
...
...
@@ -89,7 +89,7 @@ static ULONG WINAPI BitmapClipper_Release(IWICBitmapClipper *iface)
This
->
lock
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
This
->
lock
);
if
(
This
->
source
)
IWICBitmapSource_Release
(
This
->
source
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -244,7 +244,7 @@ HRESULT BitmapClipper_Create(IWICBitmapClipper **clipper)
{
BitmapClipper
*
This
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
BitmapClipper
));
This
=
malloc
(
sizeof
(
BitmapClipper
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
IWICBitmapClipper_iface
.
lpVtbl
=
&
BitmapClipper_Vtbl
;
...
...
dlls/windowscodecs/clsfactory.c
View file @
7d2bd1e4
...
...
@@ -127,7 +127,7 @@ static ULONG WINAPI ClassFactoryImpl_Release(IClassFactory *iface)
TRACE
(
"(%p) refcount=%lu
\n
"
,
iface
,
ref
);
if
(
ref
==
0
)
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
return
ref
;
}
...
...
@@ -165,7 +165,7 @@ static HRESULT ClassFactoryImpl_Constructor(const classinfo *info, REFIID riid,
*
ppv
=
NULL
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
ClassFactoryImpl
));
This
=
malloc
(
sizeof
(
ClassFactoryImpl
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
IClassFactory_iface
.
lpVtbl
=
&
ClassFactoryImpl_Vtbl
;
...
...
dlls/windowscodecs/colorcontext.c
View file @
7d2bd1e4
...
...
@@ -86,8 +86,8 @@ static ULONG WINAPI ColorContext_Release(IWICColorContext *iface)
if
(
ref
==
0
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
->
profile
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
->
profile
);
free
(
This
);
}
return
ref
;
...
...
@@ -116,7 +116,7 @@ static HRESULT load_profile(const WCHAR *filename, BYTE **profile, UINT *len)
CloseHandle
(
handle
);
return
E_FAIL
;
}
if
(
!
(
*
profile
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
.
u
.
LowPart
)))
if
(
!
(
*
profile
=
malloc
(
size
.
u
.
LowPart
)))
{
CloseHandle
(
handle
);
return
E_OUTOFMEMORY
;
...
...
@@ -124,12 +124,12 @@ static HRESULT load_profile(const WCHAR *filename, BYTE **profile, UINT *len)
ret
=
ReadFile
(
handle
,
*
profile
,
size
.
u
.
LowPart
,
&
count
,
NULL
);
CloseHandle
(
handle
);
if
(
!
ret
)
{
HeapFree
(
GetProcessHeap
(),
0
,
*
profile
);
free
(
*
profile
);
*
profile
=
NULL
;
return
HRESULT_FROM_WIN32
(
GetLastError
());
}
if
(
count
!=
size
.
u
.
LowPart
)
{
HeapFree
(
GetProcessHeap
(),
0
,
*
profile
);
free
(
*
profile
);
*
profile
=
NULL
;
return
E_FAIL
;
}
...
...
@@ -154,7 +154,7 @@ static HRESULT WINAPI ColorContext_InitializeFromFilename(IWICColorContext *ifac
hr
=
load_profile
(
wzFilename
,
&
profile
,
&
len
);
if
(
FAILED
(
hr
))
return
hr
;
HeapFree
(
GetProcessHeap
(),
0
,
This
->
profile
);
free
(
This
->
profile
);
This
->
profile
=
profile
;
This
->
profile_len
=
len
;
This
->
type
=
WICColorContextProfile
;
...
...
@@ -172,10 +172,10 @@ static HRESULT WINAPI ColorContext_InitializeFromMemory(IWICColorContext *iface,
if
(
This
->
type
!=
WICColorContextUninitialized
&&
This
->
type
!=
WICColorContextProfile
)
return
WINCODEC_ERR_WRONGSTATE
;
if
(
!
(
profile
=
HeapAlloc
(
GetProcessHeap
(),
0
,
cbBufferSize
)))
return
E_OUTOFMEMORY
;
if
(
!
(
profile
=
malloc
(
cbBufferSize
)))
return
E_OUTOFMEMORY
;
memcpy
(
profile
,
pbBuffer
,
cbBufferSize
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
profile
);
free
(
This
->
profile
);
This
->
profile
=
profile
;
This
->
profile_len
=
cbBufferSize
;
This
->
type
=
WICColorContextProfile
;
...
...
@@ -259,7 +259,7 @@ HRESULT ColorContext_Create(IWICColorContext **colorcontext)
if
(
!
colorcontext
)
return
E_INVALIDARG
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
ColorContext
));
This
=
malloc
(
sizeof
(
ColorContext
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
IWICColorContext_iface
.
lpVtbl
=
&
ColorContext_Vtbl
;
...
...
dlls/windowscodecs/colortransform.c
View file @
7d2bd1e4
...
...
@@ -85,7 +85,7 @@ static ULONG WINAPI ColorTransform_Release(IWICColorTransform *iface)
if
(
ref
==
0
)
{
if
(
This
->
dst
)
IWICBitmapSource_Release
(
This
->
dst
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -175,7 +175,7 @@ HRESULT ColorTransform_Create(IWICColorTransform **colortransform)
if
(
!
colortransform
)
return
E_INVALIDARG
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
ColorTransform
));
This
=
malloc
(
sizeof
(
ColorTransform
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
IWICColorTransform_iface
.
lpVtbl
=
&
ColorTransform_Vtbl
;
...
...
dlls/windowscodecs/converter.c
View file @
7d2bd1e4
This diff is collapsed.
Click to expand it.
dlls/windowscodecs/ddsformat.c
View file @
7d2bd1e4
...
...
@@ -793,9 +793,9 @@ static ULONG WINAPI DdsFrameDecode_Release(IWICBitmapFrameDecode *iface)
TRACE
(
"(%p) refcount=%lu
\n
"
,
iface
,
ref
);
if
(
ref
==
0
)
{
if
(
This
->
pixel_data
!=
This
->
block_data
)
HeapFree
(
GetProcessHeap
(),
0
,
This
->
pixel_data
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
block_data
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
if
(
This
->
pixel_data
!=
This
->
block_data
)
free
(
This
->
pixel_data
);
free
(
This
->
block_data
);
free
(
This
);
}
return
ref
;
...
...
@@ -884,7 +884,7 @@ static HRESULT WINAPI DdsFrameDecode_CopyPixels(IWICBitmapFrameDecode *iface,
if
(
!
This
->
pixel_data
)
{
if
(
is_compressed
(
This
->
info
.
format
))
{
This
->
pixel_data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
frame_size
);
This
->
pixel_data
=
malloc
(
frame_size
);
if
(
!
This
->
pixel_data
)
{
hr
=
E_OUTOFMEMORY
;
goto
end
;
...
...
@@ -1045,7 +1045,7 @@ static HRESULT DdsFrameDecode_CreateInstance(DdsFrameDecode **frame_decode)
{
DdsFrameDecode
*
result
;
result
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
result
));
result
=
malloc
(
sizeof
(
*
result
));
if
(
!
result
)
return
E_OUTOFMEMORY
;
result
->
IWICBitmapFrameDecode_iface
.
lpVtbl
=
&
DdsFrameDecode_Vtbl
;
...
...
@@ -1104,7 +1104,7 @@ static ULONG WINAPI DdsDecoder_Release(IWICBitmapDecoder *iface)
This
->
lock
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
This
->
lock
);
if
(
This
->
stream
)
IStream_Release
(
This
->
stream
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -1403,7 +1403,7 @@ static HRESULT WINAPI DdsDecoder_Dds_GetFrame(IWICDdsDecoder *iface,
frame_decode
->
info
.
height_in_blocks
=
frame_height_in_blocks
;
frame_decode
->
info
.
pixel_format
=
This
->
info
.
pixel_format
;
frame_decode
->
info
.
pixel_format_bpp
=
This
->
info
.
pixel_format_bpp
;
frame_decode
->
block_data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
frame_size
);
frame_decode
->
block_data
=
malloc
(
frame_size
);
frame_decode
->
pixel_data
=
NULL
;
hr
=
IStream_Seek
(
This
->
stream
,
seek
,
SEEK_SET
,
NULL
);
if
(
hr
!=
S_OK
)
goto
end
;
...
...
@@ -1565,7 +1565,7 @@ static ULONG WINAPI DdsFrameEncode_Release(IWICBitmapFrameEncode *iface)
if
(
ref
==
0
)
{
IWICBitmapEncoder_Release
(
&
This
->
parent
->
IWICBitmapEncoder_iface
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -1752,7 +1752,7 @@ HRESULT DdsDecoder_CreateInstance(REFIID iid, void** ppv)
*
ppv
=
NULL
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
DdsDecoder
));
This
=
malloc
(
sizeof
(
DdsDecoder
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
IWICBitmapDecoder_iface
.
lpVtbl
=
&
DdsDecoder_Vtbl
;
...
...
@@ -1884,7 +1884,7 @@ static HRESULT WINAPI DdsEncoder_Dds_CreateNewFrame(IWICDdsEncoder *iface,
goto
end
;
}
result
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
result
));
result
=
malloc
(
sizeof
(
*
result
));
if
(
!
result
)
{
hr
=
E_OUTOFMEMORY
;
...
...
@@ -1966,7 +1966,7 @@ static ULONG WINAPI DdsEncoder_Release(IWICBitmapEncoder *iface)
This
->
lock
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
This
->
lock
);
if
(
This
->
stream
)
IStream_Release
(
This
->
stream
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -2129,7 +2129,7 @@ HRESULT DdsEncoder_CreateInstance( REFIID iid, void **ppv)
*
ppv
=
NULL
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
DdsEncoder
));
This
=
malloc
(
sizeof
(
DdsEncoder
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
IWICBitmapEncoder_iface
.
lpVtbl
=
&
DdsEncoder_Vtbl
;
...
...
dlls/windowscodecs/decoder.c
View file @
7d2bd1e4
...
...
@@ -92,7 +92,7 @@ static ULONG WINAPI CommonDecoder_Release(IWICBitmapDecoder *iface)
This
->
lock
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
This
->
lock
);
decoder_destroy
(
This
->
decoder
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -310,8 +310,8 @@ static ULONG WINAPI CommonDecoderFrame_Release(IWICBitmapFrameDecode *iface)
if
(
ref
==
0
)
{
IWICBitmapDecoder_Release
(
&
This
->
parent
->
IWICBitmapDecoder_iface
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
metadata_blocks
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
->
metadata_blocks
);
free
(
This
);
}
return
ref
;
...
...
@@ -493,7 +493,7 @@ static HRESULT WINAPI CommonDecoderFrame_GetColorContexts(IWICBitmapFrameDecode
{
hr
=
IWICColorContext_InitializeFromMemory
(
ppIColorContexts
[
i
],
profile
,
profile_len
);
HeapFree
(
GetProcessHeap
(),
0
,
profile
);
free
(
profile
);
}
if
(
FAILED
(
hr
))
...
...
@@ -732,7 +732,7 @@ static HRESULT WINAPI CommonDecoder_GetFrame(IWICBitmapDecoder *iface,
if
(
SUCCEEDED
(
hr
))
{
result
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
result
));
result
=
malloc
(
sizeof
(
*
result
));
if
(
!
result
)
hr
=
E_OUTOFMEMORY
;
}
...
...
@@ -754,7 +754,7 @@ static HRESULT WINAPI CommonDecoder_GetFrame(IWICBitmapDecoder *iface,
hr
=
CommonDecoderFrame_InitializeMetadata
(
result
);
if
(
FAILED
(
hr
))
HeapFree
(
GetProcessHeap
(),
0
,
result
);
free
(
result
);
}
LeaveCriticalSection
(
&
This
->
lock
);
...
...
@@ -785,7 +785,7 @@ HRESULT CommonDecoder_CreateInstance(struct decoder *decoder,
TRACE
(
"(%s,%s,%p)
\n
"
,
debugstr_guid
(
&
decoder_info
->
clsid
),
debugstr_guid
(
iid
),
ppv
);
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
This
));
This
=
malloc
(
sizeof
(
*
This
));
if
(
!
This
)
{
decoder_destroy
(
decoder
);
...
...
dlls/windowscodecs/encoder.c
View file @
7d2bd1e4
...
...
@@ -130,7 +130,7 @@ static ULONG WINAPI CommonEncoderFrame_Release(IWICBitmapFrameEncode *iface)
if
(
ref
==
0
)
{
IWICBitmapEncoder_Release
(
&
This
->
parent
->
IWICBitmapEncoder_iface
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -546,7 +546,7 @@ static ULONG WINAPI CommonEncoder_Release(IWICBitmapEncoder *iface)
if
(
This
->
stream
)
IStream_Release
(
This
->
stream
);
encoder_destroy
(
This
->
encoder
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -779,7 +779,7 @@ static HRESULT WINAPI CommonEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
return
WINCODEC_ERR_NOTINITIALIZED
;
}
result
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
result
));
result
=
calloc
(
1
,
sizeof
(
*
result
));
if
(
!
result
)
{
LeaveCriticalSection
(
&
This
->
lock
);
...
...
@@ -802,7 +802,7 @@ static HRESULT WINAPI CommonEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
if
(
FAILED
(
hr
))
{
LeaveCriticalSection
(
&
This
->
lock
);
HeapFree
(
GetProcessHeap
(),
0
,
result
);
free
(
result
);
return
hr
;
}
}
...
...
@@ -874,7 +874,7 @@ HRESULT CommonEncoder_CreateInstance(struct encoder *encoder,
*
ppv
=
NULL
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
CommonEncoder
));
This
=
malloc
(
sizeof
(
CommonEncoder
));
if
(
!
This
)
{
encoder_destroy
(
encoder
);
...
...
dlls/windowscodecs/fliprotate.c
View file @
7d2bd1e4
...
...
@@ -91,7 +91,7 @@ static ULONG WINAPI FlipRotator_Release(IWICBitmapFlipRotator *iface)
This
->
lock
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
This
->
lock
);
if
(
This
->
source
)
IWICBitmapSource_Release
(
This
->
source
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -267,7 +267,7 @@ HRESULT FlipRotator_Create(IWICBitmapFlipRotator **fliprotator)
{
FlipRotator
*
This
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
FlipRotator
));
This
=
malloc
(
sizeof
(
FlipRotator
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
IWICBitmapFlipRotator_iface
.
lpVtbl
=
&
FlipRotator_Vtbl
;
...
...
dlls/windowscodecs/gifformat.c
View file @
7d2bd1e4
...
...
@@ -81,7 +81,7 @@ static HRESULT load_LSD_metadata(IStream *stream, const GUID *vendor, DWORD opti
hr
=
IStream_Read
(
stream
,
&
lsd_data
,
sizeof
(
lsd_data
),
&
bytesread
);
if
(
FAILED
(
hr
)
||
bytesread
!=
sizeof
(
lsd_data
))
return
S_OK
;
result
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
MetadataItem
)
*
9
);
result
=
calloc
(
9
,
sizeof
(
MetadataItem
)
);
if
(
!
result
)
return
E_OUTOFMEMORY
;
for
(
i
=
0
;
i
<
9
;
i
++
)
...
...
@@ -169,7 +169,7 @@ static HRESULT load_IMD_metadata(IStream *stream, const GUID *vendor, DWORD opti
hr
=
IStream_Read
(
stream
,
&
imd_data
,
sizeof
(
imd_data
),
&
bytesread
);
if
(
FAILED
(
hr
)
||
bytesread
!=
sizeof
(
imd_data
))
return
S_OK
;
result
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
MetadataItem
)
*
8
);
result
=
calloc
(
8
,
sizeof
(
MetadataItem
)
);
if
(
!
result
)
return
E_OUTOFMEMORY
;
for
(
i
=
0
;
i
<
8
;
i
++
)
...
...
@@ -262,7 +262,7 @@ static HRESULT load_GCE_metadata(IStream *stream, const GUID *vendor, DWORD opti
hr
=
IStream_Read
(
stream
,
&
gce_data
,
sizeof
(
gce_data
),
&
bytesread
);
if
(
FAILED
(
hr
)
||
bytesread
!=
sizeof
(
gce_data
))
return
S_OK
;
result
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
MetadataItem
)
*
5
);
result
=
calloc
(
5
,
sizeof
(
MetadataItem
)
);
if
(
!
result
)
return
E_OUTOFMEMORY
;
for
(
i
=
0
;
i
<
5
;
i
++
)
...
...
@@ -377,7 +377,7 @@ static HRESULT load_APE_metadata(IStream *stream, const GUID *vendor, DWORD opti
data_size
+=
subblock_size
+
1
;
}
result
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
MetadataItem
)
*
2
);
result
=
calloc
(
2
,
sizeof
(
MetadataItem
)
);
if
(
!
result
)
{
CoTaskMemFree
(
data
);
...
...
@@ -482,7 +482,7 @@ static HRESULT load_GifComment_metadata(IStream *stream, const GUID *vendor, DWO
data
[
data_size
]
=
0
;
result
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
MetadataItem
));
result
=
calloc
(
1
,
sizeof
(
MetadataItem
));
if
(
!
result
)
{
CoTaskMemFree
(
data
);
...
...
@@ -652,7 +652,7 @@ static ULONG WINAPI GifFrameDecode_Release(IWICBitmapFrameDecode *iface)
if
(
ref
==
0
)
{
IWICBitmapDecoder_Release
(
&
This
->
parent
->
IWICBitmapDecoder_iface
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -1072,7 +1072,7 @@ static ULONG WINAPI GifDecoder_Release(IWICBitmapDecoder *iface)
}
This
->
lock
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
This
->
lock
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -1267,7 +1267,7 @@ static HRESULT WINAPI GifDecoder_GetFrame(IWICBitmapDecoder *iface,
if
(
index
>=
This
->
gif
->
ImageCount
)
return
E_INVALIDARG
;
result
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
GifFrameDecode
));
result
=
malloc
(
sizeof
(
GifFrameDecode
));
if
(
!
result
)
return
E_OUTOFMEMORY
;
result
->
IWICBitmapFrameDecode_iface
.
lpVtbl
=
&
GifFrameDecode_Vtbl
;
...
...
@@ -1405,7 +1405,7 @@ HRESULT GifDecoder_CreateInstance(REFIID iid, void** ppv)
*
ppv
=
NULL
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
GifDecoder
));
This
=
malloc
(
sizeof
(
GifDecoder
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
IWICBitmapDecoder_iface
.
lpVtbl
=
&
GifDecoder_Vtbl
;
...
...
@@ -1511,8 +1511,8 @@ static ULONG WINAPI GifFrameEncode_Release(IWICBitmapFrameEncode *iface)
if
(
!
ref
)
{
IWICBitmapEncoder_Release
(
&
This
->
encoder
->
IWICBitmapEncoder_iface
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
image_data
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
->
image_data
);
free
(
This
);
}
return
ref
;
...
...
@@ -1553,9 +1553,9 @@ static HRESULT WINAPI GifFrameEncode_SetSize(IWICBitmapFrameEncode *iface, UINT
if
(
This
->
initialized
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
->
image_data
);
free
(
This
->
image_data
);
This
->
image_data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
width
*
height
);
This
->
image_data
=
malloc
(
width
*
height
);
if
(
This
->
image_data
)
{
This
->
width
=
width
;
...
...
@@ -2158,7 +2158,7 @@ static ULONG WINAPI GifEncoder_Release(IWICBitmapEncoder *iface)
if
(
This
->
stream
)
IStream_Release
(
This
->
stream
);
This
->
lock
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
This
->
lock
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -2370,7 +2370,7 @@ static HRESULT WINAPI GifEncoder_CreateNewFrame(IWICBitmapEncoder *iface, IWICBi
if
(
This
->
initialized
&&
!
This
->
committed
)
{
GifFrameEncode
*
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
ret
));
GifFrameEncode
*
ret
=
malloc
(
sizeof
(
*
ret
));
if
(
ret
)
{
This
->
n_frames
++
;
...
...
@@ -2475,7 +2475,7 @@ HRESULT GifEncoder_CreateInstance(REFIID iid, void **ppv)
*
ppv
=
NULL
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
This
));
This
=
malloc
(
sizeof
(
*
This
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
IWICBitmapEncoder_iface
.
lpVtbl
=
&
GifEncoder_Vtbl
;
...
...
dlls/windowscodecs/icoformat.c
View file @
7d2bd1e4
...
...
@@ -123,8 +123,8 @@ static ULONG WINAPI IcoFrameDecode_Release(IWICBitmapFrameDecode *iface)
if
(
ref
==
0
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
->
bits
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
->
bits
);
free
(
This
);
}
return
ref
;
...
...
@@ -247,7 +247,7 @@ static HRESULT ReadIcoDib(IStream *stream, IcoFrameDecode *result)
if
(
SUCCEEDED
(
hr
))
{
result
->
bits
=
HeapAlloc
(
GetProcessHeap
(),
0
,
result
->
width
*
result
->
height
*
4
);
result
->
bits
=
malloc
(
result
->
width
*
result
->
height
*
4
);
if
(
!
result
->
bits
)
hr
=
E_OUTOFMEMORY
;
}
...
...
@@ -336,7 +336,7 @@ static HRESULT ReadIcoDib(IStream *stream, IcoFrameDecode *result)
if
(
SUCCEEDED
(
hr
))
{
tempdata
=
HeapAlloc
(
GetProcessHeap
(),
0
,
andBytes
);
tempdata
=
malloc
(
andBytes
);
if
(
!
tempdata
)
hr
=
E_OUTOFMEMORY
;
}
...
...
@@ -376,7 +376,7 @@ static HRESULT ReadIcoDib(IStream *stream, IcoFrameDecode *result)
}
}
HeapFree
(
GetProcessHeap
(),
0
,
tempdata
);
free
(
tempdata
);
}
}
...
...
@@ -412,7 +412,7 @@ static HRESULT ReadIcoPng(IStream *stream, IcoFrameDecode *result)
hr
=
IWICBitmapFrameDecode_GetResolution
(
sourceFrame
,
&
result
->
dpiX
,
&
result
->
dpiY
);
if
(
FAILED
(
hr
))
goto
end
;
result
->
bits
=
HeapAlloc
(
GetProcessHeap
(),
0
,
4
*
result
->
width
*
result
->
height
);
result
->
bits
=
malloc
(
4
*
result
->
width
*
result
->
height
);
if
(
result
->
bits
==
NULL
)
{
hr
=
E_OUTOFMEMORY
;
...
...
@@ -480,7 +480,7 @@ static ULONG WINAPI IcoDecoder_Release(IWICBitmapDecoder *iface)
This
->
lock
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
This
->
lock
);
if
(
This
->
stream
)
IStream_Release
(
This
->
stream
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -668,7 +668,7 @@ static HRESULT WINAPI IcoDecoder_GetFrame(IWICBitmapDecoder *iface,
goto
fail
;
}
result
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
IcoFrameDecode
));
result
=
malloc
(
sizeof
(
IcoFrameDecode
));
if
(
!
result
)
{
hr
=
E_OUTOFMEMORY
;
...
...
@@ -730,7 +730,7 @@ static HRESULT WINAPI IcoDecoder_GetFrame(IWICBitmapDecoder *iface,
fail:
LeaveCriticalSection
(
&
This
->
lock
);
HeapFree
(
GetProcessHeap
(),
0
,
result
);
free
(
result
);
if
(
substream
)
IWICStream_Release
(
substream
);
if
(
SUCCEEDED
(
hr
))
hr
=
E_FAIL
;
TRACE
(
"<-- %lx
\n
"
,
hr
);
...
...
@@ -763,7 +763,7 @@ HRESULT IcoDecoder_CreateInstance(REFIID iid, void** ppv)
*
ppv
=
NULL
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
IcoDecoder
));
This
=
malloc
(
sizeof
(
IcoDecoder
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
IWICBitmapDecoder_iface
.
lpVtbl
=
&
IcoDecoder_Vtbl
;
...
...
dlls/windowscodecs/imgfactory.c
View file @
7d2bd1e4
...
...
@@ -96,7 +96,7 @@ static ULONG WINAPI ImagingFactory_Release(IWICImagingFactory2 *iface)
TRACE
(
"(%p) refcount=%lu
\n
"
,
iface
,
ref
);
if
(
ref
==
0
)
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
return
ref
;
}
...
...
@@ -924,7 +924,7 @@ static HRESULT WINAPI ImagingFactory_CreateBitmapFromHICON(IWICImagingFactory2 *
{
BYTE
*
mask
;
mask
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
mask
=
malloc
(
size
);
if
(
!
mask
)
{
IWICBitmapLock_Release
(
lock
);
...
...
@@ -951,7 +951,7 @@ static HRESULT WINAPI ImagingFactory_CreateBitmapFromHICON(IWICImagingFactory2 *
}
}
HeapFree
(
GetProcessHeap
(),
0
,
mask
);
free
(
mask
);
}
else
{
...
...
@@ -1470,7 +1470,7 @@ HRESULT ImagingFactory_CreateInstance(REFIID iid, void** ppv)
*
ppv
=
NULL
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
This
));
This
=
malloc
(
sizeof
(
*
This
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
IWICImagingFactory2_iface
.
lpVtbl
=
&
ImagingFactory_Vtbl
;
...
...
dlls/windowscodecs/info.c
View file @
7d2bd1e4
...
...
@@ -31,7 +31,6 @@
#include "wine/debug.h"
#include "wine/list.h"
#include "wine/rbtree.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
wincodecs
);
...
...
@@ -247,8 +246,8 @@ static ULONG WINAPI BitmapDecoderInfo_Release(IWICBitmapDecoderInfo *iface)
if
(
ref
==
0
)
{
RegCloseKey
(
This
->
classkey
);
heap_
free
(
This
->
patterns
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
->
patterns
);
free
(
This
);
}
return
ref
;
...
...
@@ -465,9 +464,9 @@ static HRESULT WINAPI BitmapDecoderInfo_MatchesPattern(IWICBitmapDecoderInfo *if
{
if
(
datasize
<
This
->
patterns
[
i
].
Length
)
{
HeapFree
(
GetProcessHeap
(),
0
,
data
);
free
(
data
);
datasize
=
This
->
patterns
[
i
].
Length
;
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
This
->
patterns
[
i
].
Length
);
data
=
malloc
(
This
->
patterns
[
i
].
Length
);
if
(
!
data
)
{
hr
=
E_OUTOFMEMORY
;
...
...
@@ -507,7 +506,7 @@ static HRESULT WINAPI BitmapDecoderInfo_MatchesPattern(IWICBitmapDecoderInfo *if
*
pfMatches
=
FALSE
;
}
HeapFree
(
GetProcessHeap
(),
0
,
data
);
free
(
data
);
return
hr
;
}
...
...
@@ -573,7 +572,7 @@ static void read_bitmap_patterns(BitmapDecoderInfo *info)
}
patterns_size
=
pattern_count
*
sizeof
(
WICBitmapPattern
);
patterns
=
heap_
alloc
(
patterns_size
);
patterns
=
m
alloc
(
patterns_size
);
if
(
!
patterns
)
{
RegCloseKey
(
patternskey
);
...
...
@@ -607,9 +606,9 @@ static void read_bitmap_patterns(BitmapDecoderInfo *info)
RegCloseKey
(
patternkey
);
}
if
(
res
!=
ERROR_SUCCESS
||
!
(
patterns_ptr
=
heap_
realloc
(
patterns
,
patterns_size
)))
if
(
res
!=
ERROR_SUCCESS
||
!
(
patterns_ptr
=
realloc
(
patterns
,
patterns_size
)))
{
heap_
free
(
patterns
);
free
(
patterns
);
RegCloseKey
(
patternskey
);
return
;
}
...
...
@@ -645,7 +644,7 @@ static void read_bitmap_patterns(BitmapDecoderInfo *info)
if
(
res
!=
ERROR_SUCCESS
)
{
heap_
free
(
patterns
);
free
(
patterns
);
return
;
}
...
...
@@ -658,7 +657,7 @@ static HRESULT BitmapDecoderInfo_Constructor(HKEY classkey, REFCLSID clsid, Comp
{
BitmapDecoderInfo
*
This
;
This
=
heap_alloc_zero
(
sizeof
(
BitmapDecoderInfo
));
This
=
calloc
(
1
,
sizeof
(
BitmapDecoderInfo
));
if
(
!
This
)
{
RegCloseKey
(
classkey
);
...
...
@@ -731,7 +730,7 @@ static ULONG WINAPI BitmapEncoderInfo_Release(IWICBitmapEncoderInfo *iface)
if
(
ref
==
0
)
{
RegCloseKey
(
This
->
classkey
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -951,7 +950,7 @@ static HRESULT BitmapEncoderInfo_Constructor(HKEY classkey, REFCLSID clsid, Comp
{
BitmapEncoderInfo
*
This
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
BitmapEncoderInfo
));
This
=
malloc
(
sizeof
(
BitmapEncoderInfo
));
if
(
!
This
)
{
RegCloseKey
(
classkey
);
...
...
@@ -1021,7 +1020,7 @@ static ULONG WINAPI FormatConverterInfo_Release(IWICFormatConverterInfo *iface)
if
(
ref
==
0
)
{
RegCloseKey
(
This
->
classkey
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -1164,7 +1163,7 @@ static HRESULT FormatConverterInfo_Constructor(HKEY classkey, REFCLSID clsid, Co
{
FormatConverterInfo
*
This
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
FormatConverterInfo
));
This
=
malloc
(
sizeof
(
FormatConverterInfo
));
if
(
!
This
)
{
RegCloseKey
(
classkey
);
...
...
@@ -1235,7 +1234,7 @@ static ULONG WINAPI PixelFormatInfo_Release(IWICPixelFormatInfo2 *iface)
if
(
ref
==
0
)
{
RegCloseKey
(
This
->
classkey
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -1452,7 +1451,7 @@ static HRESULT PixelFormatInfo_Constructor(HKEY classkey, REFCLSID clsid, Compon
{
PixelFormatInfo
*
This
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
PixelFormatInfo
));
This
=
malloc
(
sizeof
(
PixelFormatInfo
));
if
(
!
This
)
{
RegCloseKey
(
classkey
);
...
...
@@ -1547,10 +1546,10 @@ static ULONG WINAPI MetadataReaderInfo_Release(IWICMetadataReaderInfo *iface)
unsigned
i
;
RegCloseKey
(
This
->
classkey
);
for
(
i
=
0
;
i
<
This
->
container_count
;
i
++
)
heap_
free
(
This
->
containers
[
i
].
patterns
);
heap_
free
(
This
->
containers
);
heap_
free
(
This
->
container_formats
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
->
containers
[
i
].
patterns
);
free
(
This
->
containers
);
free
(
This
->
container_formats
);
free
(
This
);
}
return
ref
;
}
...
...
@@ -1747,9 +1746,9 @@ static HRESULT WINAPI MetadataReaderInfo_MatchesPattern(IWICMetadataReaderInfo *
{
if
(
datasize
<
container
->
patterns
[
i
].
Length
)
{
HeapFree
(
GetProcessHeap
(),
0
,
data
);
free
(
data
);
datasize
=
container
->
patterns
[
i
].
Length
;
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
container
->
patterns
[
i
].
Length
);
data
=
malloc
(
container
->
patterns
[
i
].
Length
);
if
(
!
data
)
{
hr
=
E_OUTOFMEMORY
;
...
...
@@ -1785,7 +1784,7 @@ static HRESULT WINAPI MetadataReaderInfo_MatchesPattern(IWICMetadataReaderInfo *
*
matches
=
FALSE
;
}
HeapFree
(
GetProcessHeap
(),
0
,
data
);
free
(
data
);
return
hr
;
}
...
...
@@ -1854,7 +1853,7 @@ static void read_metadata_patterns(MetadataReaderInfo *info, GUID *container_gui
}
patterns_size
=
pattern_count
*
sizeof
(
WICMetadataPattern
);
patterns
=
heap_
alloc
(
patterns_size
);
patterns
=
m
alloc
(
patterns_size
);
if
(
!
patterns
)
{
RegCloseKey
(
guid_key
);
...
...
@@ -1887,9 +1886,9 @@ static void read_metadata_patterns(MetadataReaderInfo *info, GUID *container_gui
RegCloseKey
(
patternkey
);
}
if
(
res
!=
ERROR_SUCCESS
||
!
(
patterns_ptr
=
heap_
realloc
(
patterns
,
patterns_size
)))
if
(
res
!=
ERROR_SUCCESS
||
!
(
patterns_ptr
=
realloc
(
patterns
,
patterns_size
)))
{
heap_
free
(
patterns
);
free
(
patterns
);
RegCloseKey
(
guid_key
);
return
;
}
...
...
@@ -1925,7 +1924,7 @@ static void read_metadata_patterns(MetadataReaderInfo *info, GUID *container_gui
if
(
res
!=
ERROR_SUCCESS
)
{
heap_
free
(
patterns
);
free
(
patterns
);
return
;
}
...
...
@@ -1943,14 +1942,14 @@ static BOOL read_metadata_info(MetadataReaderInfo *info)
hr
=
ComponentInfo_GetGuidList
(
info
->
classkey
,
L"Containers"
,
0
,
NULL
,
&
format_count
);
if
(
FAILED
(
hr
))
return
TRUE
;
formats
=
heap_
calloc
(
format_count
,
sizeof
(
*
formats
));
formats
=
calloc
(
format_count
,
sizeof
(
*
formats
));
if
(
!
formats
)
return
FALSE
;
hr
=
ComponentInfo_GetGuidList
(
info
->
classkey
,
L"Containers"
,
format_count
,
formats
,
&
format_count
);
if
(
FAILED
(
hr
))
{
heap_
free
(
formats
);
free
(
formats
);
return
FALSE
;
}
...
...
@@ -1961,7 +1960,7 @@ static BOOL read_metadata_info(MetadataReaderInfo *info)
{
unsigned
i
;
info
->
containers
=
heap_
calloc
(
format_count
,
sizeof
(
*
info
->
containers
));
info
->
containers
=
calloc
(
format_count
,
sizeof
(
*
info
->
containers
));
if
(
!
info
->
containers
)
return
FALSE
;
for
(
i
=
0
;
i
<
format_count
;
i
++
)
...
...
@@ -1975,7 +1974,7 @@ static HRESULT MetadataReaderInfo_Constructor(HKEY classkey, REFCLSID clsid, Com
{
MetadataReaderInfo
*
This
;
This
=
heap_alloc_zero
(
sizeof
(
*
This
));
This
=
calloc
(
1
,
sizeof
(
*
This
));
if
(
!
This
)
{
RegCloseKey
(
classkey
);
...
...
@@ -2199,11 +2198,11 @@ static ULONG WINAPI ComponentEnum_Release(IEnumUnknown *iface)
{
IUnknown_Release
(
cursor
->
unk
);
list_remove
(
&
cursor
->
entry
);
HeapFree
(
GetProcessHeap
(),
0
,
cursor
);
free
(
cursor
);
}
This
->
lock
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
This
->
lock
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -2281,7 +2280,7 @@ static HRESULT WINAPI ComponentEnum_Clone(IEnumUnknown *iface, IEnumUnknown **pp
HRESULT
ret
=
S_OK
;
struct
list
*
old_cursor
;
new_enum
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
ComponentEnum
));
new_enum
=
malloc
(
sizeof
(
ComponentEnum
));
if
(
!
new_enum
)
{
*
ppenum
=
NULL
;
...
...
@@ -2301,7 +2300,7 @@ static HRESULT WINAPI ComponentEnum_Clone(IEnumUnknown *iface, IEnumUnknown **pp
LIST_FOR_EACH_ENTRY
(
old_item
,
&
This
->
objects
,
ComponentEnumItem
,
entry
)
{
new_item
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
ComponentEnumItem
));
new_item
=
malloc
(
sizeof
(
ComponentEnumItem
));
if
(
!
new_item
)
{
ret
=
E_OUTOFMEMORY
;
...
...
@@ -2352,7 +2351,7 @@ HRESULT CreateComponentEnumerator(DWORD componentTypes, DWORD options, IEnumUnkn
if
(
res
!=
ERROR_SUCCESS
)
return
HRESULT_FROM_WIN32
(
res
);
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
ComponentEnum
));
This
=
malloc
(
sizeof
(
ComponentEnum
));
if
(
!
This
)
{
RegCloseKey
(
clsidkey
);
...
...
@@ -2382,7 +2381,7 @@ HRESULT CreateComponentEnumerator(DWORD componentTypes, DWORD options, IEnumUnkn
res
=
RegEnumKeyExW
(
instancekey
,
i
,
guidstring
,
&
guidstring_size
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
res
!=
ERROR_SUCCESS
)
break
;
item
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
ComponentEnumItem
));
item
=
malloc
(
sizeof
(
ComponentEnumItem
));
if
(
!
item
)
{
hr
=
E_OUTOFMEMORY
;
break
;
}
hr
=
CLSIDFromString
(
guidstring
,
&
clsid
);
...
...
@@ -2395,7 +2394,7 @@ HRESULT CreateComponentEnumerator(DWORD componentTypes, DWORD options, IEnumUnkn
if
(
FAILED
(
hr
))
{
HeapFree
(
GetProcessHeap
(),
0
,
item
);
free
(
item
);
hr
=
S_OK
;
}
}
...
...
dlls/windowscodecs/libjpeg.c
View file @
7d2bd1e4
...
...
@@ -98,7 +98,7 @@ static void CDECL jpeg_decoder_destroy(struct decoder* iface)
if
(
This
->
cinfo_initialized
)
jpeg_destroy_decompress
(
&
This
->
cinfo
);
free
(
This
->
image_data
);
RtlFreeHeap
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
static
void
source_mgr_init_source
(
j_decompress_ptr
cinfo
)
...
...
@@ -340,7 +340,7 @@ HRESULT CDECL jpeg_decoder_create(struct decoder_info *info, struct decoder **re
{
struct
jpeg_decoder
*
This
;
This
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
sizeof
(
struct
jpeg_decoder
));
This
=
malloc
(
sizeof
(
struct
jpeg_decoder
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
decoder
.
vtable
=
&
jpeg_decoder_vtable
;
...
...
@@ -618,7 +618,7 @@ static void CDECL jpeg_encoder_destroy(struct encoder* iface)
struct
jpeg_encoder
*
This
=
impl_from_encoder
(
iface
);
if
(
This
->
cinfo_initialized
)
jpeg_destroy_compress
(
&
This
->
cinfo
);
RtlFreeHeap
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
};
static
const
struct
encoder_funcs
jpeg_encoder_vtable
=
{
...
...
@@ -635,7 +635,7 @@ HRESULT CDECL jpeg_encoder_create(struct encoder_info *info, struct encoder **re
{
struct
jpeg_encoder
*
This
;
This
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
sizeof
(
struct
jpeg_encoder
));
This
=
malloc
(
sizeof
(
struct
jpeg_encoder
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
encoder
.
vtable
=
&
jpeg_encoder_vtable
;
...
...
dlls/windowscodecs/libpng.c
View file @
7d2bd1e4
...
...
@@ -392,8 +392,7 @@ static HRESULT CDECL png_decoder_get_metadata_blocks(struct decoder* iface,
ULONG
new_metadata_blocks_size
;
new_metadata_blocks_size
=
4
+
metadata_blocks_size
*
2
;
new_metadata_blocks
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
new_metadata_blocks_size
*
sizeof
(
*
new_metadata_blocks
));
new_metadata_blocks
=
malloc
(
new_metadata_blocks_size
*
sizeof
(
*
new_metadata_blocks
));
if
(
!
new_metadata_blocks
)
{
...
...
@@ -404,7 +403,7 @@ static HRESULT CDECL png_decoder_get_metadata_blocks(struct decoder* iface,
memcpy
(
new_metadata_blocks
,
result
,
*
count
*
sizeof
(
*
new_metadata_blocks
));
RtlFreeHeap
(
GetProcessHeap
(),
0
,
result
);
free
(
result
);
result
=
new_metadata_blocks
;
metadata_blocks_size
=
new_metadata_blocks_size
;
}
...
...
@@ -427,7 +426,7 @@ end:
{
*
count
=
0
;
*
blocks
=
NULL
;
RtlFreeHeap
(
GetProcessHeap
(),
0
,
result
);
free
(
result
);
}
return
hr
;
}
...
...
@@ -437,7 +436,7 @@ static HRESULT CDECL png_decoder_get_color_context(struct decoder* iface, UINT f
{
struct
png_decoder
*
This
=
impl_from_decoder
(
iface
);
*
data
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
This
->
color_profile_len
);
*
data
=
malloc
(
This
->
color_profile_len
);
*
datasize
=
This
->
color_profile_len
;
if
(
!*
data
)
...
...
@@ -454,7 +453,7 @@ static void CDECL png_decoder_destroy(struct decoder* iface)
free
(
This
->
image_bits
);
free
(
This
->
color_profile
);
RtlFreeHeap
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
static
const
struct
decoder_funcs
png_decoder_vtable
=
{
...
...
@@ -470,7 +469,7 @@ HRESULT CDECL png_decoder_create(struct decoder_info *info, struct decoder **res
{
struct
png_decoder
*
This
;
This
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
sizeof
(
*
This
));
This
=
malloc
(
sizeof
(
*
This
));
if
(
!
This
)
{
...
...
@@ -802,7 +801,7 @@ static void CDECL png_encoder_destroy(struct encoder *encoder)
if
(
This
->
png_ptr
)
png_destroy_write_struct
(
&
This
->
png_ptr
,
&
This
->
info_ptr
);
free
(
This
->
data
);
RtlFreeHeap
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
static
const
struct
encoder_funcs
png_encoder_vtable
=
{
...
...
@@ -819,7 +818,7 @@ HRESULT CDECL png_encoder_create(struct encoder_info *info, struct encoder **res
{
struct
png_encoder
*
This
;
This
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
sizeof
(
*
This
));
This
=
malloc
(
sizeof
(
*
This
));
if
(
!
This
)
{
...
...
dlls/windowscodecs/libtiff.c
View file @
7d2bd1e4
...
...
@@ -1017,7 +1017,7 @@ static HRESULT CDECL tiff_decoder_get_color_context(struct decoder *iface,
}
*
datasize
=
len
;
*
data
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
len
);
*
data
=
malloc
(
len
);
if
(
!*
data
)
return
E_OUTOFMEMORY
;
...
...
@@ -1052,7 +1052,7 @@ static HRESULT CDECL tiff_decoder_get_metadata_blocks(struct decoder *iface,
result
.
options
|=
WICPersistOptionNoCacheStream
|
DECODER_BLOCK_FULL_STREAM
|
DECODER_BLOCK_READER_CLSID
;
result
.
reader_clsid
=
CLSID_WICIfdMetadataReader
;
*
blocks
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
sizeof
(
**
blocks
));
*
blocks
=
malloc
(
sizeof
(
**
blocks
));
**
blocks
=
result
;
return
S_OK
;
...
...
@@ -1063,7 +1063,7 @@ static void CDECL tiff_decoder_destroy(struct decoder* iface)
struct
tiff_decoder
*
This
=
impl_from_decoder
(
iface
);
if
(
This
->
tiff
)
TIFFClose
(
This
->
tiff
);
free
(
This
->
cached_tile
);
RtlFreeHeap
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
static
const
struct
decoder_funcs
tiff_decoder_vtable
=
{
...
...
@@ -1079,7 +1079,7 @@ HRESULT CDECL tiff_decoder_create(struct decoder_info *info, struct decoder **re
{
struct
tiff_decoder
*
This
;
This
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
sizeof
(
*
This
));
This
=
malloc
(
sizeof
(
*
This
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
decoder
.
vtable
=
&
tiff_decoder_vtable
;
...
...
@@ -1300,7 +1300,7 @@ static void CDECL tiff_encoder_destroy(struct encoder* iface)
struct
tiff_encoder
*
This
=
impl_from_encoder
(
iface
);
if
(
This
->
tiff
)
TIFFClose
(
This
->
tiff
);
RtlFreeHeap
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
static
const
struct
encoder_funcs
tiff_encoder_vtable
=
{
...
...
@@ -1317,7 +1317,7 @@ HRESULT CDECL tiff_encoder_create(struct encoder_info *info, struct encoder **re
{
struct
tiff_encoder
*
This
;
This
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
sizeof
(
*
This
));
This
=
malloc
(
sizeof
(
*
This
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
encoder
.
vtable
=
&
tiff_encoder_vtable
;
...
...
dlls/windowscodecs/metadatahandler.c
View file @
7d2bd1e4
...
...
@@ -64,7 +64,7 @@ static void MetadataHandler_FreeItems(MetadataHandler *This)
PropVariantClear
(
&
This
->
items
[
i
].
value
);
}
HeapFree
(
GetProcessHeap
(),
0
,
This
->
items
);
free
(
This
->
items
);
}
static
HRESULT
MetadataHandlerEnum_Create
(
MetadataHandler
*
parent
,
DWORD
index
,
...
...
@@ -122,7 +122,7 @@ static ULONG WINAPI MetadataHandler_Release(IWICMetadataWriter *iface)
MetadataHandler_FreeItems
(
This
);
This
->
lock
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
This
->
lock
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -400,7 +400,7 @@ HRESULT MetadataReader_Create(const MetadataHandlerVtbl *vtable, REFIID iid, voi
*
ppv
=
NULL
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
MetadataHandler
));
This
=
malloc
(
sizeof
(
MetadataHandler
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
IWICMetadataWriter_iface
.
lpVtbl
=
&
MetadataHandler_Vtbl
;
...
...
@@ -475,7 +475,7 @@ static ULONG WINAPI MetadataHandlerEnum_Release(IWICEnumMetadataItem *iface)
if
(
ref
==
0
)
{
IWICMetadataWriter_Release
(
&
This
->
parent
->
IWICMetadataWriter_iface
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -594,7 +594,7 @@ static HRESULT MetadataHandlerEnum_Create(MetadataHandler *parent, DWORD index,
*
ppIEnumMetadataItem
=
NULL
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
MetadataHandlerEnum
));
This
=
malloc
(
sizeof
(
MetadataHandlerEnum
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
IWICMetadataWriter_AddRef
(
&
parent
->
IWICMetadataWriter_iface
);
...
...
@@ -635,7 +635,7 @@ static HRESULT LoadUnknownMetadata(IStream *input, const GUID *preferred_vendor,
return
hr
;
}
result
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
MetadataItem
));
result
=
calloc
(
1
,
sizeof
(
MetadataItem
));
if
(
!
result
)
{
CoTaskMemFree
(
data
);
...
...
@@ -1019,14 +1019,14 @@ static HRESULT LoadIfdMetadata(IStream *input, const GUID *preferred_vendor,
SWAP_USHORT
(
count
);
entry
=
HeapAlloc
(
GetProcessHeap
(),
0
,
count
*
sizeof
(
*
entry
));
entry
=
malloc
(
count
*
sizeof
(
*
entry
));
if
(
!
entry
)
return
E_OUTOFMEMORY
;
hr
=
IStream_Read
(
input
,
entry
,
count
*
sizeof
(
*
entry
),
&
bytesread
);
if
(
bytesread
!=
count
*
sizeof
(
*
entry
))
hr
=
E_FAIL
;
if
(
hr
!=
S_OK
)
{
HeapFree
(
GetProcessHeap
(),
0
,
entry
);
free
(
entry
);
return
hr
;
}
...
...
@@ -1061,14 +1061,14 @@ static HRESULT LoadIfdMetadata(IStream *input, const GUID *preferred_vendor,
if
(
hr
!=
S_OK
||
i
==
4096
)
{
HeapFree
(
GetProcessHeap
(),
0
,
entry
);
free
(
entry
);
return
WINCODEC_ERR_BADMETADATAHEADER
;
}
result
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
count
*
sizeof
(
*
result
));
result
=
calloc
(
count
,
sizeof
(
*
result
));
if
(
!
result
)
{
HeapFree
(
GetProcessHeap
(),
0
,
entry
);
free
(
entry
);
return
E_OUTOFMEMORY
;
}
...
...
@@ -1077,13 +1077,13 @@ static HRESULT LoadIfdMetadata(IStream *input, const GUID *preferred_vendor,
hr
=
load_IFD_entry
(
input
,
&
entry
[
i
],
&
result
[
i
],
native_byte_order
);
if
(
FAILED
(
hr
))
{
HeapFree
(
GetProcessHeap
(),
0
,
entry
);
HeapFree
(
GetProcessHeap
(),
0
,
result
);
free
(
entry
);
free
(
result
);
return
hr
;
}
}
HeapFree
(
GetProcessHeap
(),
0
,
entry
);
free
(
entry
);
*
items
=
result
;
*
item_count
=
count
;
...
...
dlls/windowscodecs/palette.c
View file @
7d2bd1e4
...
...
@@ -90,8 +90,8 @@ static ULONG WINAPI PaletteImpl_Release(IWICPalette *iface)
{
This
->
lock
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
This
->
lock
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
colors
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
->
colors
);
free
(
This
);
}
return
ref
;
...
...
@@ -103,7 +103,7 @@ static WICColor *generate_gray16_palette(UINT *count)
UINT
i
;
*
count
=
16
;
entries
=
HeapAlloc
(
GetProcessHeap
(),
0
,
16
*
sizeof
(
WICColor
));
entries
=
malloc
(
16
*
sizeof
(
WICColor
));
if
(
!
entries
)
return
NULL
;
for
(
i
=
0
;
i
<
16
;
i
++
)
...
...
@@ -120,7 +120,7 @@ static WICColor *generate_gray256_palette(UINT *count)
UINT
i
;
*
count
=
256
;
entries
=
HeapAlloc
(
GetProcessHeap
(),
0
,
256
*
sizeof
(
WICColor
));
entries
=
malloc
(
256
*
sizeof
(
WICColor
));
if
(
!
entries
)
return
NULL
;
for
(
i
=
0
;
i
<
256
;
i
++
)
...
...
@@ -137,7 +137,7 @@ static WICColor *generate_halftone8_palette(UINT *count, BOOL add_transparent)
UINT
i
;
*
count
=
add_transparent
?
17
:
16
;
entries
=
HeapAlloc
(
GetProcessHeap
(),
0
,
*
count
*
sizeof
(
WICColor
));
entries
=
malloc
(
*
count
*
sizeof
(
WICColor
));
if
(
!
entries
)
return
NULL
;
for
(
i
=
0
;
i
<
8
;
i
++
)
...
...
@@ -168,7 +168,7 @@ static WICColor *generate_halftone27_palette(UINT *count, BOOL add_transparent)
UINT
i
;
*
count
=
add_transparent
?
29
:
28
;
entries
=
HeapAlloc
(
GetProcessHeap
(),
0
,
*
count
*
sizeof
(
WICColor
));
entries
=
malloc
(
*
count
*
sizeof
(
WICColor
));
if
(
!
entries
)
return
NULL
;
for
(
i
=
0
;
i
<
27
;
i
++
)
...
...
@@ -193,7 +193,7 @@ static WICColor *generate_halftone64_palette(UINT *count, BOOL add_transparent)
UINT
i
;
*
count
=
add_transparent
?
73
:
72
;
entries
=
HeapAlloc
(
GetProcessHeap
(),
0
,
*
count
*
sizeof
(
WICColor
));
entries
=
malloc
(
*
count
*
sizeof
(
WICColor
));
if
(
!
entries
)
return
NULL
;
for
(
i
=
0
;
i
<
64
;
i
++
)
...
...
@@ -225,7 +225,7 @@ static WICColor *generate_halftone125_palette(UINT *count, BOOL add_transparent)
UINT
i
;
*
count
=
add_transparent
?
127
:
126
;
entries
=
HeapAlloc
(
GetProcessHeap
(),
0
,
*
count
*
sizeof
(
WICColor
));
entries
=
malloc
(
*
count
*
sizeof
(
WICColor
));
if
(
!
entries
)
return
NULL
;
for
(
i
=
0
;
i
<
125
;
i
++
)
...
...
@@ -250,7 +250,7 @@ static WICColor *generate_halftone216_palette(UINT *count, BOOL add_transparent)
UINT
i
;
*
count
=
add_transparent
?
225
:
224
;
entries
=
HeapAlloc
(
GetProcessHeap
(),
0
,
*
count
*
sizeof
(
WICColor
));
entries
=
malloc
(
*
count
*
sizeof
(
WICColor
));
if
(
!
entries
)
return
NULL
;
for
(
i
=
0
;
i
<
216
;
i
++
)
...
...
@@ -282,7 +282,7 @@ static WICColor *generate_halftone252_palette(UINT *count, BOOL add_transparent)
UINT
i
;
*
count
=
add_transparent
?
253
:
252
;
entries
=
HeapAlloc
(
GetProcessHeap
(),
0
,
*
count
*
sizeof
(
WICColor
));
entries
=
malloc
(
*
count
*
sizeof
(
WICColor
));
if
(
!
entries
)
return
NULL
;
for
(
i
=
0
;
i
<
252
;
i
++
)
...
...
@@ -307,7 +307,7 @@ static WICColor *generate_halftone256_palette(UINT *count, BOOL add_transparent)
UINT
i
;
*
count
=
256
;
entries
=
HeapAlloc
(
GetProcessHeap
(),
0
,
256
*
sizeof
(
WICColor
));
entries
=
malloc
(
256
*
sizeof
(
WICColor
));
if
(
!
entries
)
return
NULL
;
for
(
i
=
0
;
i
<
256
;
i
++
)
...
...
@@ -339,7 +339,7 @@ static HRESULT WINAPI PaletteImpl_InitializePredefined(IWICPalette *iface,
{
case
WICBitmapPaletteTypeFixedBW
:
count
=
2
;
colors
=
HeapAlloc
(
GetProcessHeap
(),
0
,
count
*
sizeof
(
WICColor
));
colors
=
malloc
(
count
*
sizeof
(
WICColor
));
if
(
!
colors
)
return
E_OUTOFMEMORY
;
colors
[
0
]
=
0xff000000
;
colors
[
1
]
=
0xffffffff
;
...
...
@@ -347,7 +347,7 @@ static HRESULT WINAPI PaletteImpl_InitializePredefined(IWICPalette *iface,
case
WICBitmapPaletteTypeFixedGray4
:
count
=
4
;
colors
=
HeapAlloc
(
GetProcessHeap
(),
0
,
count
*
sizeof
(
WICColor
));
colors
=
malloc
(
count
*
sizeof
(
WICColor
));
if
(
!
colors
)
return
E_OUTOFMEMORY
;
colors
[
0
]
=
0xff000000
;
colors
[
1
]
=
0xff555555
;
...
...
@@ -406,7 +406,7 @@ static HRESULT WINAPI PaletteImpl_InitializePredefined(IWICPalette *iface,
}
EnterCriticalSection
(
&
This
->
lock
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
colors
);
free
(
This
->
colors
);
This
->
colors
=
colors
;
This
->
count
=
count
;
This
->
type
=
type
;
...
...
@@ -430,13 +430,13 @@ static HRESULT WINAPI PaletteImpl_InitializeCustom(IWICPalette *iface,
else
{
if
(
!
pColors
)
return
E_INVALIDARG
;
new_colors
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WICColor
)
*
colorCount
);
new_colors
=
malloc
(
sizeof
(
WICColor
)
*
colorCount
);
if
(
!
new_colors
)
return
E_OUTOFMEMORY
;
memcpy
(
new_colors
,
pColors
,
sizeof
(
WICColor
)
*
colorCount
);
}
EnterCriticalSection
(
&
This
->
lock
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
colors
);
free
(
This
->
colors
);
This
->
colors
=
new_colors
;
This
->
count
=
colorCount
;
This
->
type
=
WICBitmapPaletteTypeCustom
;
...
...
@@ -612,7 +612,7 @@ static int median_cut(unsigned char *image, unsigned int width, unsigned int hei
struct
box
*
b1
,
*
b2
;
int
numboxes
,
i
;
if
(
!
(
h
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
h
))))
if
(
!
(
h
=
calloc
(
1
,
sizeof
(
*
h
))))
return
0
;
for
(
y
=
0
;
y
<
height
;
y
++
)
...
...
@@ -641,7 +641,7 @@ static int median_cut(unsigned char *image, unsigned int width, unsigned int hei
for
(
i
=
0
;
i
<
numboxes
;
i
++
)
colors
[
i
]
=
box_color
(
h
,
&
boxes
[
i
]);
HeapFree
(
GetProcessHeap
(),
0
,
h
);
free
(
h
);
return
numboxes
;
}
...
...
@@ -739,18 +739,18 @@ static HRESULT WINAPI PaletteImpl_InitializeFromPalette(IWICPalette *iface,
if
(
hr
!=
S_OK
)
return
hr
;
if
(
count
)
{
colors
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
WICColor
)
*
count
);
colors
=
malloc
(
sizeof
(
WICColor
)
*
count
);
if
(
!
colors
)
return
E_OUTOFMEMORY
;
hr
=
IWICPalette_GetColors
(
source
,
count
,
colors
,
&
count
);
if
(
hr
!=
S_OK
)
{
HeapFree
(
GetProcessHeap
(),
0
,
colors
);
free
(
colors
);
return
hr
;
}
}
EnterCriticalSection
(
&
This
->
lock
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
colors
);
free
(
This
->
colors
);
This
->
colors
=
colors
;
This
->
count
=
count
;
This
->
type
=
type
;
...
...
@@ -898,7 +898,7 @@ HRESULT PaletteImpl_Create(IWICPalette **palette)
{
PaletteImpl
*
This
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
PaletteImpl
));
This
=
malloc
(
sizeof
(
PaletteImpl
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
IWICPalette_iface
.
lpVtbl
=
&
PaletteImpl_Vtbl
;
...
...
dlls/windowscodecs/pngformat.c
View file @
7d2bd1e4
...
...
@@ -61,19 +61,19 @@ static HRESULT LoadTextMetadata(IStream *stream, const GUID *preferred_vendor,
if
(
!
name_end_ptr
||
name_len
>
79
)
{
HeapFree
(
GetProcessHeap
(),
0
,
data
);
free
(
data
);
return
E_FAIL
;
}
value_len
=
data_size
-
name_len
-
1
;
result
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
MetadataItem
));
result
=
calloc
(
1
,
sizeof
(
MetadataItem
));
name
=
CoTaskMemAlloc
(
name_len
+
1
);
value
=
CoTaskMemAlloc
(
value_len
+
1
);
if
(
!
result
||
!
name
||
!
value
)
{
HeapFree
(
GetProcessHeap
(),
0
,
data
);
HeapFree
(
GetProcessHeap
(),
0
,
result
);
free
(
data
);
free
(
result
);
CoTaskMemFree
(
name
);
CoTaskMemFree
(
value
);
return
E_OUTOFMEMORY
;
...
...
@@ -95,7 +95,7 @@ static HRESULT LoadTextMetadata(IStream *stream, const GUID *preferred_vendor,
*
items
=
result
;
*
item_count
=
1
;
HeapFree
(
GetProcessHeap
(),
0
,
data
);
free
(
data
);
return
S_OK
;
}
...
...
@@ -127,19 +127,19 @@ static HRESULT LoadGamaMetadata(IStream *stream, const GUID *preferred_vendor,
if
(
data_size
<
4
)
{
HeapFree
(
GetProcessHeap
(),
0
,
data
);
free
(
data
);
return
E_FAIL
;
}
gamma
=
read_ulong_be
(
data
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
free
(
data
);
result
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
MetadataItem
));
result
=
calloc
(
1
,
sizeof
(
MetadataItem
));
SHStrDupW
(
L"ImageGamma"
,
&
name
);
if
(
!
result
||
!
name
)
{
HeapFree
(
GetProcessHeap
(),
0
,
result
);
free
(
result
);
CoTaskMemFree
(
name
);
return
E_OUTOFMEMORY
;
}
...
...
@@ -196,11 +196,11 @@ static HRESULT LoadChrmMetadata(IStream *stream, const GUID *preferred_vendor,
if
(
data_size
<
32
)
{
HeapFree
(
GetProcessHeap
(),
0
,
data
);
free
(
data
);
return
E_FAIL
;
}
result
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
MetadataItem
)
*
8
);
result
=
calloc
(
8
,
sizeof
(
MetadataItem
)
);
for
(
i
=
0
;
i
<
8
;
i
++
)
{
SHStrDupW
(
names
[
i
],
&
dyn_names
[
i
]);
...
...
@@ -208,10 +208,10 @@ static HRESULT LoadChrmMetadata(IStream *stream, const GUID *preferred_vendor,
}
if
(
!
result
||
i
<
8
)
{
HeapFree
(
GetProcessHeap
(),
0
,
result
);
free
(
result
);
for
(
i
=
0
;
i
<
8
;
i
++
)
CoTaskMemFree
(
dyn_names
[
i
]);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
free
(
data
);
return
E_OUTOFMEMORY
;
}
...
...
@@ -231,7 +231,7 @@ static HRESULT LoadChrmMetadata(IStream *stream, const GUID *preferred_vendor,
*
items
=
result
;
*
item_count
=
8
;
HeapFree
(
GetProcessHeap
(),
0
,
data
);
free
(
data
);
return
S_OK
;
}
...
...
@@ -265,18 +265,18 @@ static HRESULT LoadHistMetadata(IStream *stream, const GUID *preferred_vendor,
elements
=
CoTaskMemAlloc
(
element_count
*
sizeof
(
USHORT
));
if
(
!
elements
)
{
HeapFree
(
GetProcessHeap
(),
0
,
data
);
free
(
data
);
return
E_OUTOFMEMORY
;
}
for
(
i
=
0
;
i
<
element_count
;
i
++
)
elements
[
i
]
=
read_ushort_be
(
data
+
i
*
2
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
free
(
data
);
result
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
MetadataItem
));
result
=
calloc
(
1
,
sizeof
(
MetadataItem
));
SHStrDupW
(
L"Frequencies"
,
&
name
);
if
(
!
result
||
!
name
)
{
HeapFree
(
GetProcessHeap
(),
0
,
result
);
free
(
result
);
CoTaskMemFree
(
name
);
CoTaskMemFree
(
elements
);
return
E_OUTOFMEMORY
;
...
...
@@ -335,11 +335,11 @@ static HRESULT LoadTimeMetadata(IStream *stream, const GUID *preferred_vendor,
if
(
data_size
!=
7
)
{
HeapFree
(
GetProcessHeap
(),
0
,
data
);
free
(
data
);
return
E_FAIL
;
}
result
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
MetadataItem
)
*
6
);
result
=
calloc
(
6
,
sizeof
(
MetadataItem
)
);
for
(
i
=
0
;
i
<
6
;
i
++
)
{
SHStrDupW
(
names
[
i
],
&
id_values
[
i
]);
...
...
@@ -347,10 +347,10 @@ static HRESULT LoadTimeMetadata(IStream *stream, const GUID *preferred_vendor,
}
if
(
!
result
||
i
<
6
)
{
HeapFree
(
GetProcessHeap
(),
0
,
result
);
free
(
result
);
for
(
i
=
0
;
i
<
6
;
i
++
)
CoTaskMemFree
(
id_values
[
i
]);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
free
(
data
);
return
E_OUTOFMEMORY
;
}
...
...
@@ -380,7 +380,7 @@ static HRESULT LoadTimeMetadata(IStream *stream, const GUID *preferred_vendor,
*
items
=
result
;
*
item_count
=
6
;
HeapFree
(
GetProcessHeap
(),
0
,
data
);
free
(
data
);
return
S_OK
;
}
...
...
dlls/windowscodecs/propertybag.c
View file @
7d2bd1e4
...
...
@@ -96,9 +96,9 @@ static ULONG WINAPI PropertyBag_Release(IPropertyBag2 *iface)
}
}
HeapFree
(
GetProcessHeap
(),
0
,
This
->
properties
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
values
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
->
properties
);
free
(
This
->
values
);
free
(
This
);
}
return
ref
;
...
...
@@ -282,7 +282,7 @@ HRESULT CreatePropertyBag2(const PROPBAG2 *options, UINT count,
HRESULT
res
=
S_OK
;
PropertyBag
*
This
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
PropertyBag
));
This
=
malloc
(
sizeof
(
PropertyBag
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
IPropertyBag2_iface
.
lpVtbl
=
&
PropertyBag_Vtbl
;
...
...
@@ -296,8 +296,8 @@ HRESULT CreatePropertyBag2(const PROPBAG2 *options, UINT count,
}
else
{
This
->
properties
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
PROPBAG2
)
*
count
);
This
->
values
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
VARIANT
)
*
count
);
This
->
properties
=
calloc
(
count
,
sizeof
(
PROPBAG2
)
);
This
->
values
=
calloc
(
count
,
sizeof
(
VARIANT
)
);
if
(
!
This
->
properties
||
!
This
->
values
)
res
=
E_OUTOFMEMORY
;
...
...
dlls/windowscodecs/scaler.c
View file @
7d2bd1e4
...
...
@@ -106,7 +106,7 @@ static ULONG WINAPI BitmapScaler_Release(IWICBitmapScaler *iface)
This
->
lock
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
This
->
lock
);
if
(
This
->
source
)
IWICBitmapSource_Release
(
This
->
source
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
...
...
@@ -277,13 +277,13 @@ static HRESULT WINAPI BitmapScaler_CopyPixels(IWICBitmapScaler *iface,
src_bytesperrow
=
(
src_rect
.
Width
*
This
->
bpp
+
7
)
/
8
;
buffer_size
=
src_bytesperrow
*
src_rect
.
Height
;
src_rows
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
BYTE
*
)
*
src_rect
.
Height
);
src_bits
=
HeapAlloc
(
GetProcessHeap
(),
0
,
buffer_size
);
src_rows
=
malloc
(
sizeof
(
BYTE
*
)
*
src_rect
.
Height
);
src_bits
=
malloc
(
buffer_size
);
if
(
!
src_rows
||
!
src_bits
)
{
HeapFree
(
GetProcessHeap
(),
0
,
src_rows
);
HeapFree
(
GetProcessHeap
(),
0
,
src_bits
);
free
(
src_rows
);
free
(
src_bits
);
hr
=
E_OUTOFMEMORY
;
goto
end
;
}
...
...
@@ -303,8 +303,8 @@ static HRESULT WINAPI BitmapScaler_CopyPixels(IWICBitmapScaler *iface,
}
}
HeapFree
(
GetProcessHeap
(),
0
,
src_rows
);
HeapFree
(
GetProcessHeap
(),
0
,
src_bits
);
free
(
src_rows
);
free
(
src_bits
);
end:
LeaveCriticalSection
(
&
This
->
lock
);
...
...
@@ -514,7 +514,7 @@ HRESULT BitmapScaler_Create(IWICBitmapScaler **scaler)
{
BitmapScaler
*
This
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
BitmapScaler
));
This
=
malloc
(
sizeof
(
BitmapScaler
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
IWICBitmapScaler_iface
.
lpVtbl
=
&
BitmapScaler_Vtbl
;
...
...
dlls/windowscodecs/stream.c
View file @
7d2bd1e4
...
...
@@ -91,7 +91,7 @@ static ULONG WINAPI StreamOnMemory_Release(IStream *iface)
if
(
ref
==
0
)
{
This
->
lock
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
This
->
lock
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
}
...
...
@@ -326,7 +326,7 @@ static ULONG WINAPI StreamOnFileHandle_Release(IStream *iface)
IWICStream_Release
(
This
->
stream
);
UnmapViewOfFile
(
This
->
mem
);
CloseHandle
(
This
->
map
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
}
...
...
@@ -501,7 +501,7 @@ static ULONG WINAPI StreamOnStreamRange_Release(IStream *iface)
This
->
lock
.
DebugInfo
->
Spare
[
0
]
=
0
;
DeleteCriticalSection
(
&
This
->
lock
);
IStream_Release
(
This
->
stream
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
}
...
...
@@ -795,7 +795,7 @@ static ULONG WINAPI IWICStreamImpl_Release(IWICStream *iface)
if
(
ref
==
0
)
{
if
(
This
->
pStream
)
IStream_Release
(
This
->
pStream
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
);
}
return
ref
;
}
...
...
@@ -994,7 +994,7 @@ static HRESULT WINAPI IWICStreamImpl_InitializeFromMemory(IWICStream *iface,
if
(
!
pbBuffer
)
return
E_INVALIDARG
;
if
(
This
->
pStream
)
return
WINCODEC_ERR_WRONGSTATE
;
pObject
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
StreamOnMemory
));
pObject
=
malloc
(
sizeof
(
StreamOnMemory
));
if
(
!
pObject
)
return
E_OUTOFMEMORY
;
pObject
->
IStream_iface
.
lpVtbl
=
&
StreamOnMemory_Vtbl
;
...
...
@@ -1058,7 +1058,7 @@ HRESULT stream_initialize_from_filehandle(IWICStream *iface, HANDLE file)
hr
=
IWICStreamImpl_InitializeFromMemory
(
stream
,
mem
,
size
.
u
.
LowPart
);
if
(
FAILED
(
hr
))
goto
error
;
pObject
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
StreamOnFileHandle
));
pObject
=
malloc
(
sizeof
(
StreamOnFileHandle
));
if
(
!
pObject
)
{
hr
=
E_OUTOFMEMORY
;
...
...
@@ -1097,7 +1097,7 @@ static HRESULT WINAPI IWICStreamImpl_InitializeFromIStreamRegion(IWICStream *ifa
if
(
!
pIStream
)
return
E_INVALIDARG
;
if
(
This
->
pStream
)
return
WINCODEC_ERR_WRONGSTATE
;
pObject
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
StreamOnStreamRange
));
pObject
=
malloc
(
sizeof
(
StreamOnStreamRange
));
if
(
!
pObject
)
return
E_OUTOFMEMORY
;
pObject
->
IStream_iface
.
lpVtbl
=
&
StreamOnStreamRange_Vtbl
;
...
...
@@ -1153,7 +1153,7 @@ HRESULT StreamImpl_Create(IWICStream **stream)
if
(
!
stream
)
return
E_INVALIDARG
;
pObject
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
IWICStreamImpl
));
pObject
=
malloc
(
sizeof
(
IWICStreamImpl
));
if
(
!
pObject
)
{
*
stream
=
NULL
;
return
E_OUTOFMEMORY
;
...
...
dlls/windowscodecs/tgaformat.c
View file @
7d2bd1e4
...
...
@@ -170,8 +170,8 @@ static ULONG WINAPI TgaDecoder_Release(IWICBitmapDecoder *iface)
DeleteCriticalSection
(
&
This
->
lock
);
if
(
This
->
stream
)
IStream_Release
(
This
->
stream
);
HeapFree
(
GetProcessHeap
(),
0
,
This
->
imagebits
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
free
(
This
->
imagebits
);
free
(
This
);
}
return
ref
;
...
...
@@ -623,7 +623,7 @@ static HRESULT WINAPI TgaDecoder_Frame_CopyPalette(IWICBitmapFrameDecode *iface,
return
E_FAIL
;
}
colormap_data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
This
->
colormap_length
);
colormap_data
=
malloc
(
This
->
colormap_length
);
if
(
!
colormap_data
)
return
E_OUTOFMEMORY
;
wcolormap_data
=
(
WORD
*
)
colormap_data
;
...
...
@@ -743,7 +743,7 @@ static HRESULT WINAPI TgaDecoder_Frame_CopyPalette(IWICBitmapFrameDecode *iface,
}
}
HeapFree
(
GetProcessHeap
(),
0
,
colormap_data
);
free
(
colormap_data
);
if
(
SUCCEEDED
(
hr
))
hr
=
IWICPalette_InitializeCustom
(
pIPalette
,
colors
,
256
);
...
...
@@ -831,7 +831,7 @@ static HRESULT TgaDecoder_ReadImage(TgaDecoder *This)
if
(
SUCCEEDED
(
hr
))
{
datasize
=
This
->
header
.
width
*
This
->
header
.
height
*
(
This
->
header
.
depth
/
8
);
This
->
imagebits
=
HeapAlloc
(
GetProcessHeap
(),
0
,
datasize
);
This
->
imagebits
=
malloc
(
datasize
);
if
(
!
This
->
imagebits
)
hr
=
E_OUTOFMEMORY
;
}
...
...
@@ -870,7 +870,7 @@ static HRESULT TgaDecoder_ReadImage(TgaDecoder *This)
}
else
{
HeapFree
(
GetProcessHeap
(),
0
,
This
->
imagebits
);
free
(
This
->
imagebits
);
This
->
imagebits
=
NULL
;
}
}
...
...
@@ -944,7 +944,7 @@ HRESULT TgaDecoder_CreateInstance(REFIID iid, void** ppv)
*
ppv
=
NULL
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
TgaDecoder
));
This
=
malloc
(
sizeof
(
TgaDecoder
));
if
(
!
This
)
return
E_OUTOFMEMORY
;
This
->
IWICBitmapDecoder_iface
.
lpVtbl
=
&
TgaDecoder_Vtbl
;
...
...
dlls/windowscodecs/ungif.c
View file @
7d2bd1e4
...
...
@@ -58,26 +58,6 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
wincodecs
);
static
void
*
ungif_alloc
(
size_t
sz
)
{
return
HeapAlloc
(
GetProcessHeap
(),
0
,
sz
);
}
static
void
*
ungif_calloc
(
size_t
num
,
size_t
sz
)
{
return
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
num
*
sz
);
}
static
void
*
ungif_realloc
(
void
*
ptr
,
size_t
sz
)
{
return
HeapReAlloc
(
GetProcessHeap
(),
0
,
ptr
,
sz
);
}
static
void
ungif_free
(
void
*
ptr
)
{
HeapFree
(
GetProcessHeap
(),
0
,
ptr
);
}
#define LZ_MAX_CODE 4095
/* Biggest code possible in 12 bits. */
#define LZ_BITS 12
...
...
@@ -154,14 +134,14 @@ MakeMapObject(int ColorCount,
return
NULL
;
}
Object
=
ungif_
alloc
(
sizeof
(
ColorMapObject
));
Object
=
m
alloc
(
sizeof
(
ColorMapObject
));
if
(
Object
==
NULL
)
{
return
NULL
;
}
Object
->
Colors
=
ungif_
calloc
(
ColorCount
,
sizeof
(
GifColorType
));
Object
->
Colors
=
calloc
(
ColorCount
,
sizeof
(
GifColorType
));
if
(
Object
->
Colors
==
NULL
)
{
ungif_
free
(
Object
);
free
(
Object
);
return
NULL
;
}
...
...
@@ -182,8 +162,8 @@ static void
FreeMapObject
(
ColorMapObject
*
Object
)
{
if
(
Object
!=
NULL
)
{
ungif_
free
(
Object
->
Colors
);
ungif_
free
(
Object
);
free
(
Object
->
Colors
);
free
(
Object
);
/*** FIXME:
* When we are willing to break API we need to make this function
* FreeMapObject(ColorMapObject **Object)
...
...
@@ -200,12 +180,9 @@ AddExtensionBlock(Extensions *New,
ExtensionBlock
*
ep
;
if
(
New
->
ExtensionBlocks
==
NULL
)
New
->
ExtensionBlocks
=
ungif_alloc
(
sizeof
(
ExtensionBlock
));
else
New
->
ExtensionBlocks
=
ungif_realloc
(
New
->
ExtensionBlocks
,
sizeof
(
ExtensionBlock
)
*
(
New
->
ExtensionBlockCount
+
1
));
New
->
ExtensionBlocks
=
realloc
(
New
->
ExtensionBlocks
,
sizeof
(
ExtensionBlock
)
*
(
New
->
ExtensionBlockCount
+
1
));
if
(
New
->
ExtensionBlocks
==
NULL
)
return
(
GIF_ERROR
);
...
...
@@ -213,7 +190,7 @@ AddExtensionBlock(Extensions *New,
ep
=
&
New
->
ExtensionBlocks
[
New
->
ExtensionBlockCount
++
];
ep
->
ByteCount
=
Len
+
3
;
ep
->
Bytes
=
ungif_
alloc
(
ep
->
ByteCount
+
3
);
ep
->
Bytes
=
m
alloc
(
ep
->
ByteCount
+
3
);
if
(
ep
->
Bytes
==
NULL
)
return
(
GIF_ERROR
);
...
...
@@ -242,7 +219,7 @@ AppendExtensionBlock(Extensions *New,
ep
=
&
New
->
ExtensionBlocks
[
New
->
ExtensionBlockCount
-
1
];
ep
->
Bytes
=
ungif_
realloc
(
ep
->
Bytes
,
ep
->
ByteCount
+
Len
+
1
);
ep
->
Bytes
=
realloc
(
ep
->
Bytes
,
ep
->
ByteCount
+
Len
+
1
);
if
(
ep
->
Bytes
==
NULL
)
return
(
GIF_ERROR
);
...
...
@@ -266,8 +243,8 @@ FreeExtension(Extensions *Extensions)
}
for
(
ep
=
Extensions
->
ExtensionBlocks
;
ep
<
(
Extensions
->
ExtensionBlocks
+
Extensions
->
ExtensionBlockCount
);
ep
++
)
ungif_
free
(
ep
->
Bytes
);
ungif_
free
(
Extensions
->
ExtensionBlocks
);
free
(
ep
->
Bytes
);
free
(
Extensions
->
ExtensionBlocks
);
Extensions
->
ExtensionBlocks
=
NULL
;
}
...
...
@@ -290,12 +267,12 @@ FreeSavedImages(GifFileType * GifFile) {
sp
->
ImageDesc
.
ColorMap
=
NULL
;
}
ungif_
free
(
sp
->
RasterBits
);
free
(
sp
->
RasterBits
);
if
(
sp
->
Extensions
.
ExtensionBlocks
)
FreeExtension
(
&
sp
->
Extensions
);
}
ungif_
free
(
GifFile
->
SavedImages
);
free
(
GifFile
->
SavedImages
);
GifFile
->
SavedImages
=
NULL
;
}
...
...
@@ -432,16 +409,10 @@ DGifGetImageDesc(GifFileType * GifFile) {
GifFile
->
Image
.
ColorMap
=
NULL
;
}
if
(
GifFile
->
SavedImages
)
{
if
((
GifFile
->
SavedImages
=
ungif_realloc
(
GifFile
->
SavedImages
,
sizeof
(
SavedImage
)
*
(
GifFile
->
ImageCount
+
1
)))
==
NULL
)
{
return
GIF_ERROR
;
}
}
else
{
if
((
GifFile
->
SavedImages
=
ungif_alloc
(
sizeof
(
SavedImage
)))
==
NULL
)
{
return
GIF_ERROR
;
}
if
((
GifFile
->
SavedImages
=
realloc
(
GifFile
->
SavedImages
,
sizeof
(
SavedImage
)
*
(
GifFile
->
ImageCount
+
1
)))
==
NULL
)
{
return
GIF_ERROR
;
}
sp
=
&
GifFile
->
SavedImages
[
GifFile
->
ImageCount
];
...
...
@@ -896,7 +867,7 @@ DGifSlurp(GifFileType * GifFile) {
sp
=
&
GifFile
->
SavedImages
[
GifFile
->
ImageCount
-
1
];
ImageSize
=
sp
->
ImageDesc
.
Width
*
sp
->
ImageDesc
.
Height
;
sp
->
RasterBits
=
ungif_
alloc
(
ImageSize
*
sizeof
(
GifPixelType
));
sp
->
RasterBits
=
m
alloc
(
ImageSize
*
sizeof
(
GifPixelType
));
if
(
sp
->
RasterBits
==
NULL
)
{
return
GIF_ERROR
;
}
...
...
@@ -997,16 +968,16 @@ DGifOpen(void *userData,
GifFileType
*
GifFile
;
GifFilePrivateType
*
Private
;
GifFile
=
ungif_
alloc
(
sizeof
(
GifFileType
));
GifFile
=
m
alloc
(
sizeof
(
GifFileType
));
if
(
GifFile
==
NULL
)
{
return
NULL
;
}
memset
(
GifFile
,
'\0'
,
sizeof
(
GifFileType
));
Private
=
ungif_
alloc
(
sizeof
(
GifFilePrivateType
));
Private
=
m
alloc
(
sizeof
(
GifFilePrivateType
));
if
(
!
Private
)
{
ungif_
free
(
GifFile
);
free
(
GifFile
);
return
NULL
;
}
...
...
@@ -1017,8 +988,8 @@ DGifOpen(void *userData,
/* Lets see if this is a GIF file: */
if
(
READ
(
GifFile
,
Buf
,
GIF_STAMP_LEN
)
!=
GIF_STAMP_LEN
)
{
ungif_
free
(
Private
);
ungif_
free
(
GifFile
);
free
(
Private
);
free
(
GifFile
);
return
NULL
;
}
...
...
@@ -1026,14 +997,14 @@ DGifOpen(void *userData,
* something more useful with it. */
Buf
[
GIF_STAMP_LEN
]
=
0
;
if
(
memcmp
(
GIF_STAMP
,
Buf
,
GIF_VERSION_POS
)
!=
0
)
{
ungif_
free
(
Private
);
ungif_
free
(
GifFile
);
free
(
Private
);
free
(
GifFile
);
return
NULL
;
}
if
(
DGifGetScreenDesc
(
GifFile
)
==
GIF_ERROR
)
{
ungif_
free
(
Private
);
ungif_
free
(
GifFile
);
free
(
Private
);
free
(
GifFile
);
return
NULL
;
}
...
...
@@ -1063,7 +1034,7 @@ DGifCloseFile(GifFileType * GifFile) {
GifFile
->
SColorMap
=
NULL
;
}
ungif_
free
(
Private
);
free
(
Private
);
Private
=
NULL
;
if
(
GifFile
->
SavedImages
)
{
...
...
@@ -1073,7 +1044,7 @@ DGifCloseFile(GifFileType * GifFile) {
FreeExtension
(
&
GifFile
->
Extensions
);
ungif_
free
(
GifFile
);
free
(
GifFile
);
return
GIF_OK
;
}
dlls/windowscodecs/wincodecs_common.c
View file @
7d2bd1e4
...
...
@@ -151,7 +151,7 @@ HRESULT write_source(IWICBitmapFrameEncode *iface,
stride
=
(
bpp
*
width
+
7
)
/
8
;
pixeldata
=
HeapAlloc
(
GetProcessHeap
(),
0
,
stride
*
prc
->
Height
);
pixeldata
=
malloc
(
stride
*
prc
->
Height
);
if
(
!
pixeldata
)
{
IWICBitmapSource_Release
(
converted_source
);
...
...
@@ -167,7 +167,7 @@ HRESULT write_source(IWICBitmapFrameEncode *iface,
stride
*
prc
->
Height
,
pixeldata
);
}
HeapFree
(
GetProcessHeap
(),
0
,
pixeldata
);
free
(
pixeldata
);
IWICBitmapSource_Release
(
converted_source
);
return
hr
;
...
...
dlls/windowscodecs/wincodecs_common.h
View file @
7d2bd1e4
...
...
@@ -173,7 +173,7 @@ HRESULT read_png_chunk(IStream *stream, BYTE *type, BYTE **data, ULONG *data_siz
if
(
data
)
{
*
data
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
*
data_size
);
*
data
=
malloc
(
*
data_size
);
if
(
!*
data
)
return
E_OUTOFMEMORY
;
...
...
@@ -183,7 +183,7 @@ HRESULT read_png_chunk(IStream *stream, BYTE *type, BYTE **data, ULONG *data_siz
{
if
(
SUCCEEDED
(
hr
))
hr
=
E_FAIL
;
RtlFreeHeap
(
GetProcessHeap
(),
0
,
*
data
);
free
(
*
data
);
*
data
=
NULL
;
return
hr
;
}
...
...
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