Skip to content

Commit

Permalink
eliminate Coverity defects
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Apr 16, 2022
1 parent 212564a commit 6ef3cb2
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 30 deletions.
10 changes: 6 additions & 4 deletions coders/dcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -3023,11 +3023,13 @@ static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception)
greenmap=(int *) RelinquishMagickMemory(greenmap); \
if (redmap != (int *) NULL) \
redmap=(int *) RelinquishMagickMemory(redmap); \
if (stream_info->offsets != (ssize_t *) NULL) \
stream_info->offsets=(ssize_t *) RelinquishMagickMemory( \
stream_info->offsets); \
if (stream_info != (DCMStreamInfo *) NULL) \
stream_info=(DCMStreamInfo *) RelinquishMagickMemory(stream_info); \
{ \
if (stream_info->offsets != (ssize_t *) NULL) \
stream_info->offsets=(ssize_t *) RelinquishMagickMemory( \
stream_info->offsets); \
stream_info=(DCMStreamInfo *) RelinquishMagickMemory(stream_info); \
} \
if (stack != (LinkedListInfo *) NULL) \
stack=DestroyLinkedList(stack,RelinquishMagickMemory); \
ThrowReaderException((exception),(message)); \
Expand Down
6 changes: 2 additions & 4 deletions coders/png.c
Original file line number Diff line number Diff line change
Expand Up @@ -12792,10 +12792,8 @@ static MagickBooleanType WriteOneJNGImage(MngInfo *mng_info,
&image->exception);
if (blob == (unsigned char *) NULL)
{
if (jpeg_image != (Image *)NULL)
jpeg_image=DestroyImage(jpeg_image);
if (jpeg_image_info != (ImageInfo *)NULL)
jpeg_image_info=DestroyImageInfo(jpeg_image_info);
jpeg_image=DestroyImage(jpeg_image);
jpeg_image_info=DestroyImageInfo(jpeg_image_info);
return(MagickFalse);
}
jng_alpha_sample_depth=8;
Expand Down
2 changes: 1 addition & 1 deletion coders/psd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1876,7 +1876,7 @@ static MagickBooleanType ReadPSDLayersInternal(Image *image,
/*
Layer name.
*/
length=(MagickSizeType) (unsigned char) ReadBlobByte(image);
length=(MagickSizeType) ((unsigned char) ReadBlobByte(image));
combined_length+=length+1;
if (length > 0)
(void) ReadBlob(image,(size_t) length++,layer_info[i].name);
Expand Down
15 changes: 0 additions & 15 deletions coders/xps.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,21 +329,6 @@ static Image *ReadXPSImage(const ImageInfo *image_info,ExceptionInfo *exception)
break;
AppendImageToList(&postscript_image,next);
}
else
for (i=1; ; i++)
{
(void) InterpretImageFilename(image_info,image,filename,(int) i,
read_info->filename);
if (IsGhostscriptRendered(read_info->filename) == MagickFalse)
break;
read_info->blob=NULL;
read_info->length=0;
next=ReadImage(read_info,exception);
(void) RelinquishUniqueFileResource(read_info->filename);
if (next == (Image *) NULL)
break;
AppendImageToList(&postscript_image,next);
}
(void) RelinquishUniqueFileResource(filename);
read_info=DestroyImageInfo(read_info);
if (postscript_image == (Image *) NULL)
Expand Down
15 changes: 9 additions & 6 deletions magick/quantum-export.c
Original file line number Diff line number Diff line change
Expand Up @@ -3868,8 +3868,9 @@ MagickExport size_t ExportQuantumPixels(const Image *image,
/*
Associate alpha.
*/
q=GetAuthenticPixelQueue(image);
if (image_view != (CacheView *) NULL)
if (image_view == (CacheView *) NULL)
q=GetAuthenticPixelQueue(image);
else
q=(PixelPacket *) GetCacheViewVirtualPixelQueue(image_view);
for (x=0; x < (ssize_t) image->columns; x++)
{
Expand All @@ -3888,9 +3889,10 @@ MagickExport size_t ExportQuantumPixels(const Image *image,
PixelPacket
*magick_restrict q;

q=GetAuthenticPixelQueue(image);
if (image_view != (CacheView *) NULL)
if (image_view == (CacheView *) NULL)
q=GetAuthenticPixelQueue(image);
else
q=(PixelPacket *) GetCacheViewVirtualPixelQueue(image_view);
for (x=0; x < (ssize_t) number_pixels; x++)
{
quantum=GetPixelRed(q);
Expand Down Expand Up @@ -4028,8 +4030,9 @@ MagickExport size_t ExportQuantumPixels(const Image *image,
PixelPacket
*magick_restrict q;

q=GetAuthenticPixelQueue(image);
if (image_view != (CacheView *) NULL)
if (image_view == (CacheView *) NULL)
q=GetAuthenticPixelQueue(image);
else
q=(PixelPacket *) GetCacheViewVirtualPixelQueue(image_view);
for (x=0; x < (ssize_t) number_pixels; x++)
{
Expand Down

0 comments on commit 6ef3cb2

Please sign in to comment.