From 54439638f0cd2a71de193063ce125945835ec77e Mon Sep 17 00:00:00 2001 From: cristy Date: Thu, 15 Jul 2010 00:43:34 +0000 Subject: [PATCH] --- ChangeLog | 2 ++ magick/blob.c | 11 +++++++---- magick/constitute.c | 3 ++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0b44f3ba7..61db267e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2010-07-09 6.6.3-1 Cristy * Fix memory leak in for corrupt BMP images (reference http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=16600). + * Repair several issues when writing to stdout (reference + http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=16620). 2010-07-07 6.6.3-1 Glenn Randers-Pehrson * The PNG decoder failed to handle the tRNS chunk properly for grayscale diff --git a/magick/blob.c b/magick/blob.c index 19d0c76bc..a74dbfab9 100644 --- a/magick/blob.c +++ b/magick/blob.c @@ -868,7 +868,8 @@ MagickExport unsigned char *FileToBlob(const char *filename,const size_t extent, if ((size_t) (i+count) >= extent) break; } - file=close(file); + if (LocaleCompare(filename,"-") != 0) + file=close(file); if (blob == (unsigned char *) NULL) { (void) ThrowMagickException(exception,GetMagickModule(), @@ -892,7 +893,7 @@ MagickExport unsigned char *FileToBlob(const char *filename,const size_t extent, sizeof(*blob)); if (blob == (unsigned char *) NULL) { - file=close(file)-1; + file=close(file); (void) ThrowMagickException(exception,GetMagickModule(), ResourceLimitError,"MemoryAllocationFailed","`%s'",filename); return((unsigned char *) NULL); @@ -926,7 +927,8 @@ MagickExport unsigned char *FileToBlob(const char *filename,const size_t extent, } } blob[*length]='\0'; - file=close(file); + if (LocaleCompare(filename,"-") != 0) + file=close(file); if (file == -1) { blob=(unsigned char *) RelinquishMagickMemory(blob); @@ -1582,7 +1584,8 @@ MagickExport MagickBooleanType ImageToFile(Image *image,char *filename, if (i < length) break; } - file=close(file); + if (LocaleCompare(filename,"-") != 0) + file=close(file); buffer=(unsigned char *) RelinquishMagickMemory(buffer); if ((file == -1) || (i < length)) { diff --git a/magick/constitute.c b/magick/constitute.c index 06b9727a5..ee93a9bb1 100644 --- a/magick/constitute.c +++ b/magick/constitute.c @@ -772,7 +772,7 @@ MagickExport Image *ReadImage(const ImageInfo *image_info, timestamp); (void) SetImageProperty(next,"date:create",timestamp); if (read_info->verbose != MagickFalse) - (void) IdentifyImage(next,stdout,MagickFalse); + (void) IdentifyImage(next,stderr,MagickFalse); image=next; } read_info=DestroyImageInfo(read_info); @@ -1093,6 +1093,7 @@ MagickExport MagickBooleanType WriteImage(const ImageInfo *image_info, /* A seekable stream is required by the encoder. */ + write_info->adjoin=MagickTrue; (void) CopyMagickString(write_info->filename,image->filename, MaxTextExtent); (void) AcquireUniqueFilename(image->filename); -- 2.40.0