mscms: Check the return value of a couple of liblcms2 calls.

oldstable
Hans Leidekker 2015-08-06 14:46:15 +02:00 committed by Alexandre Julliard
parent 47a3719f22
commit ee84980895
2 changed files with 30 additions and 7 deletions

View File

@ -1152,7 +1152,7 @@ BOOL WINAPI IsColorProfileTagPresent( HPROFILE handle, TAGTYPE type, PBOOL prese
release_profile( profile );
return FALSE;
}
*present = cmsIsTag( profile->cmsprofile, type );
*present = (cmsIsTag( profile->cmsprofile, type ) != 0);
release_profile( profile );
ret = TRUE;
@ -1406,7 +1406,11 @@ HPROFILE WINAPI OpenColorProfileW( PPROFILE profile, DWORD access, DWORD sharing
if (!(data = HeapAlloc( GetProcessHeap(), 0, profile->cbDataSize ))) return NULL;
memcpy( data, profile->pProfileData, profile->cbDataSize );
cmsprofile = cmsOpenProfileFromMem( data, profile->cbDataSize );
if (!(cmsprofile = cmsOpenProfileFromMem( data, profile->cbDataSize )))
{
HeapFree( GetProcessHeap(), 0, data );
return FALSE;
}
size = profile->cbDataSize;
}
else if (profile->dwType == PROFILE_FILENAME)
@ -1464,7 +1468,12 @@ HPROFILE WINAPI OpenColorProfileW( PPROFILE profile, DWORD access, DWORD sharing
HeapFree( GetProcessHeap(), 0, data );
return NULL;
}
cmsprofile = cmsOpenProfileFromMem( data, size );
if (!(cmsprofile = cmsOpenProfileFromMem( data, size )))
{
CloseHandle( handle );
HeapFree( GetProcessHeap(), 0, data );
return NULL;
}
}
else
{

View File

@ -175,6 +175,12 @@ HTRANSFORM WINAPI CreateColorTransformW( LPLOGCOLORSPACEW space, HPROFILE dest,
cmsoutput = dst->cmsprofile;
transform.cmstransform = cmsCreateProofingTransform(cmsinput, in_format, cmsoutput, out_format, cmstarget,
intent, INTENT_ABSOLUTE_COLORIMETRIC, proofing);
if (!transform.cmstransform)
{
if (tgt) release_profile( tgt );
release_profile( dst );
return FALSE;
}
ret = create_transform( &transform );
@ -254,9 +260,15 @@ HTRANSFORM WINAPI CreateMultiProfileTransform( PHPROFILE profiles, DWORD nprofil
{
cmsprofiles[1] = profile1->cmsprofile;
}
transform.cmstransform = cmsCreateMultiprofileTransform( cmsprofiles, nprofiles, in_format, out_format, *intents, 0 );
transform.cmstransform = cmsCreateMultiprofileTransform( cmsprofiles, nprofiles, in_format,
out_format, *intents, 0 );
HeapFree( GetProcessHeap(), 0, cmsprofiles );
if (!transform.cmstransform)
{
release_profile( profile0 );
release_profile( profile1 );
return FALSE;
}
ret = create_transform( &transform );
}
@ -327,7 +339,8 @@ BOOL WINAPI TranslateBitmapBits( HTRANSFORM handle, PVOID srcbits, BMFORMAT inpu
outputstride, callback, data );
if (!transform) return FALSE;
cmsChangeBuffersFormat( transform->cmstransform, from_bmformat(input), from_bmformat(output) );
if (!cmsChangeBuffersFormat( transform->cmstransform, from_bmformat(input), from_bmformat(output) ))
return FALSE;
cmsDoTransform( transform->cmstransform, srcbits, destbits, width * height );
release_transform( transform );
@ -368,7 +381,8 @@ BOOL WINAPI TranslateColors( HTRANSFORM handle, PCOLOR in, DWORD count,
if (!transform) return FALSE;
xfrm = transform->cmstransform;
cmsChangeBuffersFormat( xfrm, from_type(input_type), from_type(output_type) );
if (!cmsChangeBuffersFormat( xfrm, from_type(input_type), from_type(output_type) ))
return FALSE;
switch (input_type)
{