From: cristy Date: Mon, 4 Oct 2010 16:46:15 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~8762 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b41ee108904d5e1e75fd6a944caeceb5c7d6e64a;p=imagemagick --- diff --git a/ChangeLog b/ChangeLog index 8a7d0b745..139f5871e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-10-03 6.6.4-9 Cristy + * Fix memory assertion with --enable-embeddable (reference + http://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=17201). + 2010-10-02 6.6.4-9 Anthony Thyssen * Added sqrt(2) bluring default for Gaussian Filter if used as a Cylindrical EWA filter. This resulted in the last aliasing issue diff --git a/PerlMagick/Magick.xs b/PerlMagick/Magick.xs index 122eca98d..b90c0d72c 100644 --- a/PerlMagick/Magick.xs +++ b/PerlMagick/Magick.xs @@ -578,7 +578,7 @@ static struct PackageInfo *ClonePackageInfo(struct PackageInfo *info, struct PackageInfo *clone_info; - clone_info=(struct PackageInfo *) AcquireAlignedMemory(1,sizeof(*clone_info)); + clone_info=(struct PackageInfo *) AcquireQuantumMemory(1,sizeof(*clone_info)); if (clone_info == (struct PackageInfo *) NULL) { ThrowPerlException(exception,ResourceLimitError, diff --git a/coders/dcm.c b/coders/dcm.c index 295e41ebb..40ab862c9 100644 --- a/coders/dcm.c +++ b/coders/dcm.c @@ -2882,7 +2882,7 @@ static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception) /* Read DCM preamble. */ - stream_info=(DCMStreamInfo *) AcquireAlignedMemory(1,sizeof(*stream_info)); + stream_info=(DCMStreamInfo *) AcquireQuantumMemory(1,sizeof(*stream_info)); if (stream_info == (DCMStreamInfo *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); (void) ResetMagickMemory(stream_info,0,sizeof(*stream_info)); diff --git a/coders/djvu.c b/coders/djvu.c index 3e3dac2da..923762f4d 100644 --- a/coders/djvu.c +++ b/coders/djvu.c @@ -801,7 +801,7 @@ static Image *ReadDJVUImage(const ImageInfo *image_info, /* * Allocate a LoadContext structure. */ - lc = (LoadContext *) AcquireAlignedMemory(1,sizeof(*lc)); + lc = (LoadContext *) AcquireQuantumMemory(1,sizeof(*lc)); if (lc == NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); diff --git a/coders/gif.c b/coders/gif.c index d000033f8..1601f14b3 100644 --- a/coders/gif.c +++ b/coders/gif.c @@ -202,7 +202,7 @@ static LZWInfo *AcquireLZWInfo(Image *image,const size_t data_size) size_t one; - lzw_info=(LZWInfo *) AcquireAlignedMemory(1,sizeof(*lzw_info)); + lzw_info=(LZWInfo *) AcquireQuantumMemory(1,sizeof(*lzw_info)); if (lzw_info == (LZWInfo *) NULL) return((LZWInfo *) NULL); (void) ResetMagickMemory(lzw_info,0,sizeof(*lzw_info)); @@ -234,7 +234,7 @@ static LZWInfo *AcquireLZWInfo(Image *image,const size_t data_size) lzw_info->code_info.bit=8*lzw_info->code_info.count; lzw_info->code_info.eof=MagickFalse; lzw_info->genesis=MagickTrue; - lzw_info->stack=(LZWStack *) AcquireAlignedMemory(1,sizeof(*lzw_info->stack)); + lzw_info->stack=(LZWStack *) AcquireQuantumMemory(1,sizeof(*lzw_info->stack)); if (lzw_info->stack == (LZWStack *) NULL) { lzw_info=RelinquishLZWInfo(lzw_info); diff --git a/coders/jp2.c b/coders/jp2.c index 5e3afa311..6c00cbb02 100644 --- a/coders/jp2.c +++ b/coders/jp2.c @@ -260,7 +260,8 @@ static int BlobClose(jas_stream_obj_t *object) source=(StreamManager *) object; (void) CloseBlob(source->image); - source=(StreamManager *) RelinquishMagickMemory(source); + free(source); + source=(StreamManager *) NULL; return(0); } diff --git a/coders/msl.c b/coders/msl.c index 69542c608..3be559df6 100644 --- a/coders/msl.c +++ b/coders/msl.c @@ -7597,7 +7597,7 @@ static MagickBooleanType ProcessMSLScript(const ImageInfo *image_info,Image **im msl_info.draw_info=(DrawInfo **) AcquireMagickMemory( sizeof(*msl_info.draw_info)); /* top of the stack is the MSL file itself */ - msl_info.image=(Image **) AcquireAlignedMemory(1,sizeof(*msl_info.image)); + msl_info.image=(Image **) AcquireQuantumMemory(1,sizeof(*msl_info.image)); msl_info.attributes=(Image **) AcquireMagickMemory( sizeof(*msl_info.attributes)); msl_info.group_info=(MSLGroupInfo *) AcquireMagickMemory( diff --git a/coders/png.c b/coders/png.c index 30473b076..0fae03082 100644 --- a/coders/png.c +++ b/coders/png.c @@ -3014,7 +3014,7 @@ static Image *ReadOnePNGImage(MngInfo *mng_info, create a new object buffer. */ mng_info->ob[object_id]=(MngBuffer *) - AcquireAlignedMemory(1,sizeof(MngBuffer)); + AcquireQuantumMemory(1,sizeof(MngBuffer)); if (mng_info->ob[object_id] != (MngBuffer *) NULL) { mng_info->ob[object_id]->image=(Image *) NULL; @@ -3146,7 +3146,7 @@ static Image *ReadPNGImage(const ImageInfo *image_info,ExceptionInfo *exception) Allocate a MngInfo structure. */ have_mng_structure=MagickFalse; - mng_info=(MngInfo *) AcquireAlignedMemory(1,sizeof(MngInfo)); + mng_info=(MngInfo *) AcquireQuantumMemory(1,sizeof(MngInfo)); if (mng_info == (MngInfo *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); /* @@ -3443,7 +3443,7 @@ static Image *ReadOneJNGImage(MngInfo *mng_info, open alpha_blob, attached to alpha_image */ - color_image_info=(ImageInfo *)AcquireAlignedMemory(1,sizeof(ImageInfo)); + color_image_info=(ImageInfo *)AcquireQuantumMemory(1,sizeof(ImageInfo)); if (color_image_info == (ImageInfo *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); GetImageInfo(color_image_info); @@ -3463,7 +3463,7 @@ static Image *ReadOneJNGImage(MngInfo *mng_info, if ((image_info->ping == MagickFalse) && (jng_color_type >= 12)) { alpha_image_info=(ImageInfo *) - AcquireAlignedMemory(1,sizeof(ImageInfo)); + AcquireQuantumMemory(1,sizeof(ImageInfo)); if (alpha_image_info == (ImageInfo *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); GetImageInfo(alpha_image_info); @@ -3912,7 +3912,7 @@ static Image *ReadJNGImage(const ImageInfo *image_info,ExceptionInfo *exception) Allocate a MngInfo structure. */ have_mng_structure=MagickFalse; - mng_info=(MngInfo *) AcquireAlignedMemory(1,sizeof(*mng_info)); + mng_info=(MngInfo *) AcquireQuantumMemory(1,sizeof(*mng_info)); if (mng_info == (MngInfo *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); /* @@ -4087,7 +4087,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception) /* Allocate a MngInfo structure. */ - mng_info=(MngInfo *) AcquireAlignedMemory(1,sizeof(MngInfo)); + mng_info=(MngInfo *) AcquireQuantumMemory(1,sizeof(MngInfo)); if (mng_info == (MngInfo *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); /* @@ -8243,7 +8243,7 @@ static MagickBooleanType WritePNGImage(const ImageInfo *image_info, Allocate a MngInfo structure. */ have_mng_structure=MagickFalse; - mng_info=(MngInfo *) AcquireAlignedMemory(1,sizeof(MngInfo)); + mng_info=(MngInfo *) AcquireQuantumMemory(1,sizeof(MngInfo)); if (mng_info == (MngInfo *) NULL) ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); /* @@ -8893,7 +8893,7 @@ static MagickBooleanType WriteJNGImage(const ImageInfo *image_info,Image *image) Allocate a MngInfo structure. */ have_mng_structure=MagickFalse; - mng_info=(MngInfo *) AcquireAlignedMemory(1,sizeof(MngInfo)); + mng_info=(MngInfo *) AcquireQuantumMemory(1,sizeof(MngInfo)); if (mng_info == (MngInfo *) NULL) ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); /* @@ -8989,7 +8989,7 @@ static MagickBooleanType WriteMNGImage(const ImageInfo *image_info,Image *image) Allocate a MngInfo structure. */ have_mng_structure=MagickFalse; - mng_info=(MngInfo *) AcquireAlignedMemory(1,sizeof(MngInfo)); + mng_info=(MngInfo *) AcquireQuantumMemory(1,sizeof(MngInfo)); if (mng_info == (MngInfo *) NULL) ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed"); /* diff --git a/coders/svg.c b/coders/svg.c index 784d97c0c..6ada127c1 100644 --- a/coders/svg.c +++ b/coders/svg.c @@ -260,12 +260,12 @@ static SVGInfo *AcquireSVGInfo(void) SVGInfo *svg_info; - svg_info=(SVGInfo *) AcquireAlignedMemory(1,sizeof(*svg_info)); + svg_info=(SVGInfo *) AcquireQuantumMemory(1,sizeof(*svg_info)); if (svg_info == (SVGInfo *) NULL) return((SVGInfo *) NULL); (void) ResetMagickMemory(svg_info,0,sizeof(*svg_info)); svg_info->text=AcquireString(""); - svg_info->scale=(double *) AcquireAlignedMemory(1,sizeof(*svg_info->scale)); + svg_info->scale=(double *) AcquireQuantumMemory(1,sizeof(*svg_info->scale)); if (svg_info->scale == (double *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); GetAffineMatrix(&svg_info->affine); diff --git a/coders/vid.c b/coders/vid.c index 40eab67f9..60bbbef24 100644 --- a/coders/vid.c +++ b/coders/vid.c @@ -139,7 +139,7 @@ static Image *ReadVIDImage(const ImageInfo *image_info,ExceptionInfo *exception) assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); image=AcquireImage(image_info); - filelist=(char **) AcquireAlignedMemory(1,sizeof(*filelist)); + filelist=(char **) AcquireQuantumMemory(1,sizeof(*filelist)); if (filelist == (char **) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); filelist[0]=ConstantString(image_info->filename); diff --git a/coders/xwd.c b/coders/xwd.c index 690f7ef87..e8d8b35ad 100644 --- a/coders/xwd.c +++ b/coders/xwd.c @@ -256,7 +256,7 @@ static Image *ReadXWDImage(const ImageInfo *image_info,ExceptionInfo *exception) /* Initialize the X image. */ - ximage=(XImage *) AcquireAlignedMemory(1,sizeof(*ximage)); + ximage=(XImage *) AcquireQuantumMemory(1,sizeof(*ximage)); if (ximage == (XImage *) NULL) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); ximage->depth=(int) header.pixmap_depth; diff --git a/magick/PreRvIcccm.c b/magick/PreRvIcccm.c index 5f714ccce..e16247ba1 100644 --- a/magick/PreRvIcccm.c +++ b/magick/PreRvIcccm.c @@ -127,17 +127,17 @@ Bool XSupportsLocale() */ XClassHint *XAllocClassHint) { - return((XClassHint *) AcquireAlignedMemory(1,sizeof(XClassHint))); + return((XClassHint *) AcquireQuantumMemory(1,sizeof(XClassHint))); } XIconSize *XAllocIconSize) { - return((XIconSize *) AcquireAlignedMemory(1,sizeof(XIconSize))); + return((XIconSize *) AcquireQuantumMemory(1,sizeof(XIconSize))); } XSizeHints *XAllocSizeHints) { - return((XSizeHints *) AcquireAlignedMemory(1,sizeof(XSizeHints))); + return((XSizeHints *) AcquireQuantumMemory(1,sizeof(XSizeHints))); } Status XReconfigureWMWindow(Display *display,Window window,int screen_number, @@ -148,12 +148,12 @@ Status XReconfigureWMWindow(Display *display,Window window,int screen_number, XStandardColormap *XAllocStandardColormap) { - return((XStandardColormap *) AcquireAlignedMemory(1,sizeof(XStandardColormap))); + return((XStandardColormap *) AcquireQuantumMemory(1,sizeof(XStandardColormap))); } XWMHints *XAllocWMHints) { - return((XWMHints *) AcquireAlignedMemory(1,sizeof(XWMHints))); + return((XWMHints *) AcquireQuantumMemory(1,sizeof(XWMHints))); } Status XGetGCValues(Display *display,GC gc,size_t mask, diff --git a/magick/accelerate.c b/magick/accelerate.c index 2e6274312..5c83685cc 100644 --- a/magick/accelerate.c +++ b/magick/accelerate.c @@ -477,7 +477,7 @@ static ConvolveInfo *GetConvolveInfo(const Image *image,const char *name, /* Create OpenCL info. */ - convolve_info=(ConvolveInfo *) AcquireAlignedMemory(1,sizeof(*convolve_info)); + convolve_info=(ConvolveInfo *) AcquireQuantumMemory(1,sizeof(*convolve_info)); if (convolve_info == (ConvolveInfo *) NULL) { (void) ThrowMagickException(exception,GetMagickModule(), diff --git a/magick/animate.c b/magick/animate.c index 8b66ec5a2..8249fc695 100644 --- a/magick/animate.c +++ b/magick/animate.c @@ -414,7 +414,7 @@ static Image *XMagickCommand(Display *display,XResourceInfo *resource_info, /* Expand the filenames. */ - filelist=(char **) AcquireAlignedMemory(1,sizeof(char *)); + filelist=(char **) AcquireQuantumMemory(1,sizeof(char *)); if (filelist == (char **) NULL) { ThrowXWindowException(ResourceLimitError,"MemoryAllocationFailed", diff --git a/magick/blob.c b/magick/blob.c index 956c79502..562853333 100644 --- a/magick/blob.c +++ b/magick/blob.c @@ -417,7 +417,7 @@ MagickExport BlobInfo *CloneBlobInfo(const BlobInfo *blob_info) BlobInfo *clone_info; - clone_info=(BlobInfo *) AcquireAlignedMemory(1,sizeof(*clone_info)); + clone_info=(BlobInfo *) AcquireQuantumMemory(1,sizeof(*clone_info)); if (clone_info == (BlobInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); GetBlobInfo(clone_info); diff --git a/magick/cache-view.c b/magick/cache-view.c index 4982efece..f4cc5f2e7 100644 --- a/magick/cache-view.c +++ b/magick/cache-view.c @@ -112,7 +112,7 @@ MagickExport CacheView *AcquireCacheView(const Image *image) assert(image->signature == MagickSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); - cache_view=(CacheView *) AcquireAlignedMemory(1,sizeof(*cache_view)); + cache_view=(CacheView *) AcquireQuantumMemory(1,sizeof(*cache_view)); if (cache_view == (CacheView *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(cache_view,0,sizeof(*cache_view)); @@ -159,7 +159,7 @@ MagickExport CacheView *CloneCacheView(const CacheView *cache_view) if (cache_view->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s", cache_view->image->filename); - clone_view=(CacheView *) AcquireAlignedMemory(1,sizeof(*clone_view)); + clone_view=(CacheView *) AcquireQuantumMemory(1,sizeof(*clone_view)); if (clone_view == (CacheView *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(clone_view,0,sizeof(*clone_view)); @@ -207,7 +207,7 @@ MagickExport CacheView *DestroyCacheView(CacheView *cache_view) cache_view->number_threads); cache_view->image=DestroyImage(cache_view->image); cache_view->signature=(~MagickSignature); - cache_view=(CacheView *) RelinquishAlignedMemory(cache_view); + cache_view=(CacheView *) RelinquishMagickMemory(cache_view); return(cache_view); } diff --git a/magick/cache.c b/magick/cache.c index 54a75144c..e24de0cdb 100644 --- a/magick/cache.c +++ b/magick/cache.c @@ -185,7 +185,7 @@ MagickExport Cache AcquirePixelCache(const size_t number_threads) CacheInfo *cache_info; - cache_info=(CacheInfo *) AcquireAlignedMemory(1,sizeof(*cache_info)); + cache_info=(CacheInfo *) AcquireQuantumMemory(1,sizeof(*cache_info)); if (cache_info == (CacheInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(cache_info,0,sizeof(*cache_info)); @@ -254,7 +254,7 @@ MagickExport NexusInfo **AcquirePixelCacheNexus(const size_t number_threads) register ssize_t i; - nexus_info=(NexusInfo **) AcquireAlignedMemory(number_threads, + nexus_info=(NexusInfo **) AcquireQuantumMemory(number_threads, sizeof(*nexus_info)); if (nexus_info == (NexusInfo **) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); @@ -1523,7 +1523,7 @@ MagickExport Cache DestroyPixelCache(Cache cache) if (cache_info->semaphore != (SemaphoreInfo *) NULL) DestroySemaphoreInfo(&cache_info->semaphore); cache_info->signature=(~MagickSignature); - cache_info=(CacheInfo *) RelinquishAlignedMemory(cache_info); + cache_info=(CacheInfo *) RelinquishMagickMemory(cache_info); cache=(Cache) NULL; return(cache); } @@ -1581,7 +1581,7 @@ MagickExport NexusInfo **DestroyPixelCacheNexus(NexusInfo **nexus_info, nexus_info[i]->signature=(~MagickSignature); nexus_info[i]=(NexusInfo *) RelinquishAlignedMemory(nexus_info[i]); } - nexus_info=(NexusInfo **) RelinquishAlignedMemory(nexus_info); + nexus_info=(NexusInfo **) RelinquishMagickMemory(nexus_info); return(nexus_info); } diff --git a/magick/cipher.c b/magick/cipher.c index bc01b2d72..c5418e6f8 100644 --- a/magick/cipher.c +++ b/magick/cipher.c @@ -190,7 +190,7 @@ static AESInfo *AcquireAESInfo(void) AESInfo *aes_info; - aes_info=(AESInfo *) AcquireAlignedMemory(1,sizeof(*aes_info)); + aes_info=(AESInfo *) AcquireQuantumMemory(1,sizeof(*aes_info)); if (aes_info == (AESInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(aes_info,0,sizeof(*aes_info)); diff --git a/magick/coder.c b/magick/coder.c index cce0356fa..c8f74d2f1 100644 --- a/magick/coder.c +++ b/magick/coder.c @@ -779,7 +779,7 @@ static MagickBooleanType LoadCoderList(const char *xml,const char *filename, /* Coder element. */ - coder_info=(CoderInfo *) AcquireAlignedMemory(1,sizeof(*coder_info)); + coder_info=(CoderInfo *) AcquireQuantumMemory(1,sizeof(*coder_info)); if (coder_info == (CoderInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(coder_info,0,sizeof(*coder_info)); @@ -910,7 +910,7 @@ static MagickBooleanType LoadCoderLists(const char *filename, *p; p=CoderMap+i; - coder_info=(CoderInfo *) AcquireAlignedMemory(1,sizeof(*coder_info)); + coder_info=(CoderInfo *) AcquireQuantumMemory(1,sizeof(*coder_info)); if (coder_info == (CoderInfo *) NULL) { (void) ThrowMagickException(exception,GetMagickModule(), diff --git a/magick/color.c b/magick/color.c index f1c051005..eb2df6a33 100644 --- a/magick/color.c +++ b/magick/color.c @@ -2075,7 +2075,7 @@ static MagickBooleanType LoadColorList(const char *xml,const char *filename, /* Color element. */ - color_info=(ColorInfo *) AcquireAlignedMemory(1,sizeof(*color_info)); + color_info=(ColorInfo *) AcquireQuantumMemory(1,sizeof(*color_info)); if (color_info == (ColorInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(color_info,0,sizeof(*color_info)); @@ -2219,7 +2219,7 @@ static MagickBooleanType LoadColorLists(const char *filename, *p; p=ColorMap+i; - color_info=(ColorInfo *) AcquireAlignedMemory(1,sizeof(*color_info)); + color_info=(ColorInfo *) AcquireQuantumMemory(1,sizeof(*color_info)); if (color_info == (ColorInfo *) NULL) { (void) ThrowMagickException(exception,GetMagickModule(), diff --git a/magick/compress.c b/magick/compress.c index c40605e29..6f0c8a629 100644 --- a/magick/compress.c +++ b/magick/compress.c @@ -274,7 +274,7 @@ MagickExport void Ascii85Initialize(Image *image) Allocate image structure. */ if (image->ascii85 == (Ascii85Info *) NULL) - image->ascii85=(Ascii85Info *) AcquireAlignedMemory(1,sizeof(*image->ascii85)); + image->ascii85=(Ascii85Info *) AcquireQuantumMemory(1,sizeof(*image->ascii85)); if (image->ascii85 == (Ascii85Info *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(image->ascii85,0,sizeof(*image->ascii85)); diff --git a/magick/deprecate.c b/magick/deprecate.c index 2bf9cce9f..2ae4dc504 100644 --- a/magick/deprecate.c +++ b/magick/deprecate.c @@ -2512,7 +2512,7 @@ MagickExport const ImageAttribute *GetImageAttribute(const Image *image, if (attribute != (const ImageAttribute *) NULL) return(attribute); } - attribute=(ImageAttribute *) AcquireAlignedMemory(1,sizeof(*attribute)); + attribute=(ImageAttribute *) AcquireQuantumMemory(1,sizeof(*attribute)); if (attribute == (ImageAttribute *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(attribute,0,sizeof(*attribute)); diff --git a/magick/display.c b/magick/display.c index 4498c2899..1f55eff98 100644 --- a/magick/display.c +++ b/magick/display.c @@ -2234,7 +2234,7 @@ static MagickBooleanType XAnnotateEditImage(Display *display, /* Initialize annotate structure. */ - annotate_info=(XAnnotateInfo *) AcquireAlignedMemory(1,sizeof(*annotate_info)); + annotate_info=(XAnnotateInfo *) AcquireQuantumMemory(1,sizeof(*annotate_info)); if (annotate_info == (XAnnotateInfo *) NULL) return(MagickFalse); XGetAnnotateInfo(annotate_info); @@ -13435,7 +13435,7 @@ static Image *XVisualDirectoryImage(Display *display, /* Expand the filenames. */ - filelist=(char **) AcquireAlignedMemory(1,sizeof(*filelist)); + filelist=(char **) AcquireQuantumMemory(1,sizeof(*filelist)); if (filelist == (char **) NULL) { ThrowXWindowFatalException(ResourceLimitError,"MemoryAllocationFailed", diff --git a/magick/draw.c b/magick/draw.c index 6b3827e54..61d22bb0d 100644 --- a/magick/draw.c +++ b/magick/draw.c @@ -197,7 +197,7 @@ MagickExport DrawInfo *AcquireDrawInfo(void) DrawInfo *draw_info; - draw_info=(DrawInfo *) AcquireAlignedMemory(1,sizeof(*draw_info)); + draw_info=(DrawInfo *) AcquireQuantumMemory(1,sizeof(*draw_info)); if (draw_info == (DrawInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); GetDrawInfo((ImageInfo *) NULL,draw_info); @@ -237,7 +237,7 @@ MagickExport DrawInfo *CloneDrawInfo(const ImageInfo *image_info, DrawInfo *clone_info; - clone_info=(DrawInfo *) AcquireAlignedMemory(1,sizeof(*clone_info)); + clone_info=(DrawInfo *) AcquireQuantumMemory(1,sizeof(*clone_info)); if (clone_info == (DrawInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); GetDrawInfo(image_info,clone_info); @@ -481,7 +481,7 @@ static PolygonInfo *ConvertPathToPolygon( /* Convert a path to the more efficient sorted rendering form. */ - polygon_info=(PolygonInfo *) AcquireAlignedMemory(1,sizeof(*polygon_info)); + polygon_info=(PolygonInfo *) AcquireQuantumMemory(1,sizeof(*polygon_info)); if (polygon_info == (PolygonInfo *) NULL) return((PolygonInfo *) NULL); number_edges=16; @@ -1767,7 +1767,7 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info) /* Allocate primitive info memory. */ - graphic_context=(DrawInfo **) AcquireAlignedMemory(1, + graphic_context=(DrawInfo **) AcquireQuantumMemory(1, sizeof(*graphic_context)); if (graphic_context == (DrawInfo **) NULL) { @@ -3586,7 +3586,7 @@ static PolygonInfo **DestroyPolygonThreadSet(PolygonInfo **polygon_info) for (i=0; i < (ssize_t) GetOpenMPMaximumThreads(); i++) if (polygon_info[i] != (PolygonInfo *) NULL) polygon_info[i]=DestroyPolygonInfo(polygon_info[i]); - polygon_info=(PolygonInfo **) RelinquishAlignedMemory(polygon_info); + polygon_info=(PolygonInfo **) RelinquishMagickMemory(polygon_info); return(polygon_info); } @@ -3606,7 +3606,7 @@ static PolygonInfo **AcquirePolygonThreadSet(const DrawInfo *draw_info, number_threads; number_threads=GetOpenMPMaximumThreads(); - polygon_info=(PolygonInfo **) AcquireAlignedMemory(number_threads, + polygon_info=(PolygonInfo **) AcquireQuantumMemory(number_threads, sizeof(*polygon_info)); if (polygon_info == (PolygonInfo **) NULL) return((PolygonInfo **) NULL); diff --git a/magick/effect.c b/magick/effect.c index 520ca1a5f..299245370 100644 --- a/magick/effect.c +++ b/magick/effect.c @@ -1663,7 +1663,7 @@ static Quantum **DestroyPixelThreadSet(Quantum **pixels) for (i=0; i < (ssize_t) GetOpenMPMaximumThreads(); i++) if (pixels[i] != (Quantum *) NULL) pixels[i]=(Quantum *) RelinquishMagickMemory(pixels[i]); - pixels=(Quantum **) RelinquishAlignedMemory(pixels); + pixels=(Quantum **) RelinquishMagickMemory(pixels); return(pixels); } @@ -1679,7 +1679,7 @@ static Quantum **AcquirePixelThreadSet(const size_t count) number_threads; number_threads=GetOpenMPMaximumThreads(); - pixels=(Quantum **) AcquireAlignedMemory(number_threads,sizeof(*pixels)); + pixels=(Quantum **) AcquireQuantumMemory(number_threads,sizeof(*pixels)); if (pixels == (Quantum **) NULL) return((Quantum **) NULL); (void) ResetMagickMemory(pixels,0,number_threads*sizeof(*pixels)); @@ -2632,7 +2632,7 @@ static MedianPixelList *DestroyMedianPixelList(MedianPixelList *pixel_list) if (pixel_list->lists[i].nodes != (MedianListNode *) NULL) pixel_list->lists[i].nodes=(MedianListNode *) RelinquishMagickMemory( pixel_list->lists[i].nodes); - pixel_list=(MedianPixelList *) RelinquishAlignedMemory(pixel_list); + pixel_list=(MedianPixelList *) RelinquishMagickMemory(pixel_list); return(pixel_list); } @@ -2646,7 +2646,7 @@ static MedianPixelList **DestroyMedianPixelListThreadSet( for (i=0; i < (ssize_t) GetOpenMPMaximumThreads(); i++) if (pixel_list[i] != (MedianPixelList *) NULL) pixel_list[i]=DestroyMedianPixelList(pixel_list[i]); - pixel_list=(MedianPixelList **) RelinquishAlignedMemory(pixel_list); + pixel_list=(MedianPixelList **) RelinquishMagickMemory(pixel_list); return(pixel_list); } @@ -2658,7 +2658,7 @@ static MedianPixelList *AcquireMedianPixelList(const size_t width) register ssize_t i; - pixel_list=(MedianPixelList *) AcquireAlignedMemory(1,sizeof(*pixel_list)); + pixel_list=(MedianPixelList *) AcquireQuantumMemory(1,sizeof(*pixel_list)); if (pixel_list == (MedianPixelList *) NULL) return(pixel_list); (void) ResetMagickMemory((void *) pixel_list,0,sizeof(*pixel_list)); @@ -2688,7 +2688,7 @@ static MedianPixelList **AcquireMedianPixelListThreadSet(const size_t width) number_threads; number_threads=GetOpenMPMaximumThreads(); - pixel_list=(MedianPixelList **) AcquireAlignedMemory(number_threads, + pixel_list=(MedianPixelList **) AcquireQuantumMemory(number_threads, sizeof(*pixel_list)); if (pixel_list == (MedianPixelList **) NULL) return((MedianPixelList **) NULL); diff --git a/magick/exception.c b/magick/exception.c index 4ed1857ed..6eb925a7f 100644 --- a/magick/exception.c +++ b/magick/exception.c @@ -103,7 +103,7 @@ MagickExport ExceptionInfo *AcquireExceptionInfo(void) ExceptionInfo *exception; - exception=(ExceptionInfo *) AcquireAlignedMemory(1,sizeof(*exception)); + exception=(ExceptionInfo *) AcquireQuantumMemory(1,sizeof(*exception)); if (exception == (ExceptionInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); GetExceptionInfo(exception); @@ -881,7 +881,7 @@ MagickExport MagickBooleanType ThrowException(ExceptionInfo *exception, (LocaleCompare(exception->reason,reason) == 0) && (LocaleCompare(exception->description,description) == 0)) return(MagickTrue); - p=(ExceptionInfo *) AcquireAlignedMemory(1,sizeof(*p)); + p=(ExceptionInfo *) AcquireQuantumMemory(1,sizeof(*p)); if (p == (ExceptionInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(p,0,sizeof(*p)); diff --git a/magick/fourier.c b/magick/fourier.c index b6cab9c38..8e7b21bc9 100644 --- a/magick/fourier.c +++ b/magick/fourier.c @@ -489,7 +489,7 @@ static MagickBooleanType ForwardFourierTransform(FourierInfo *fourier_info, } } image_view=DestroyCacheView(image_view); - fourier=(fftw_complex *) AcquireAlignedMemory((size_t) fourier_info->height, + fourier=(fftw_complex *) AcquireQuantumMemory((size_t) fourier_info->height, fourier_info->center*sizeof(*fourier)); if (fourier == (fftw_complex *) NULL) { @@ -542,7 +542,7 @@ static MagickBooleanType ForwardFourierTransform(FourierInfo *fourier_info, phase[i]=cimag(fourier[i]); i++; } - fourier=(fftw_complex *) RelinquishAlignedMemory(fourier); + fourier=(fftw_complex *) RelinquishMagickMemory(fourier); return(MagickTrue); } @@ -594,7 +594,7 @@ static MagickBooleanType ForwardFourierTransformChannel(const Image *image, magnitude=(double *) RelinquishMagickMemory(magnitude); return(MagickFalse); } - fourier=(fftw_complex *) AcquireAlignedMemory((size_t) fourier_info.height, + fourier=(fftw_complex *) AcquireQuantumMemory((size_t) fourier_info.height, fourier_info.center*sizeof(*fourier)); if (fourier == (fftw_complex *) NULL) { @@ -608,7 +608,7 @@ static MagickBooleanType ForwardFourierTransformChannel(const Image *image, if (status != MagickFalse) status=ForwardFourier(&fourier_info,fourier_image,magnitude,phase, exception); - fourier=(fftw_complex *) RelinquishAlignedMemory(fourier); + fourier=(fftw_complex *) RelinquishMagickMemory(fourier); phase=(double *) RelinquishMagickMemory(phase); magnitude=(double *) RelinquishMagickMemory(magnitude); return(status); @@ -1173,7 +1173,7 @@ static MagickBooleanType InverseFourierTransformChannel( magnitude=(double *) RelinquishMagickMemory(magnitude); return(MagickFalse); } - fourier=(fftw_complex *) AcquireAlignedMemory((size_t) fourier_info.height, + fourier=(fftw_complex *) AcquireQuantumMemory((size_t) fourier_info.height, fourier_info.center*sizeof(*fourier)); if (fourier == (fftw_complex *) NULL) { @@ -1189,7 +1189,7 @@ static MagickBooleanType InverseFourierTransformChannel( if (status != MagickFalse) status=InverseFourierTransform(&fourier_info,fourier,fourier_image, exception); - fourier=(fftw_complex *) RelinquishAlignedMemory(fourier); + fourier=(fftw_complex *) RelinquishMagickMemory(fourier); phase=(double *) RelinquishMagickMemory(phase); magnitude=(double *) RelinquishMagickMemory(magnitude); return(status); diff --git a/magick/fx.c b/magick/fx.c index a47060656..5c365f4cc 100644 --- a/magick/fx.c +++ b/magick/fx.c @@ -162,7 +162,7 @@ MagickExport FxInfo *AcquireFxInfo(const Image *image,const char *expression) register ssize_t i; - fx_info=(FxInfo *) AcquireAlignedMemory(1,sizeof(*fx_info)); + fx_info=(FxInfo *) AcquireQuantumMemory(1,sizeof(*fx_info)); if (fx_info == (FxInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(fx_info,0,sizeof(*fx_info)); @@ -2852,7 +2852,7 @@ static FxInfo **DestroyFxThreadSet(FxInfo **fx_info) for (i=0; i < (ssize_t) GetOpenMPMaximumThreads(); i++) if (fx_info[i] != (FxInfo *) NULL) fx_info[i]=DestroyFxInfo(fx_info[i]); - fx_info=(FxInfo **) RelinquishAlignedMemory(fx_info); + fx_info=(FxInfo **) RelinquishMagickMemory(fx_info); return(fx_info); } @@ -2875,7 +2875,7 @@ static FxInfo **AcquireFxThreadSet(const Image *image,const char *expression, number_threads; number_threads=GetOpenMPMaximumThreads(); - fx_info=(FxInfo **) AcquireAlignedMemory(number_threads,sizeof(*fx_info)); + fx_info=(FxInfo **) AcquireQuantumMemory(number_threads,sizeof(*fx_info)); if (fx_info == (FxInfo **) NULL) return((FxInfo **) NULL); (void) ResetMagickMemory(fx_info,0,number_threads*sizeof(*fx_info)); diff --git a/magick/hashmap.c b/magick/hashmap.c index bd5837ea2..d6eca49d4 100644 --- a/magick/hashmap.c +++ b/magick/hashmap.c @@ -165,7 +165,7 @@ MagickExport MagickBooleanType AppendValueToLinkedList( (void) LogMagickEvent(TraceEvent,GetMagickModule(),"..."); if (list_info->elements == list_info->capacity) return(MagickFalse); - next=(ElementInfo *) AcquireAlignedMemory(1,sizeof(*next)); + next=(ElementInfo *) AcquireQuantumMemory(1,sizeof(*next)); if (next == (ElementInfo *) NULL) return(MagickFalse); next->value=(void *) value; @@ -1035,7 +1035,7 @@ MagickExport MagickBooleanType InsertValueInLinkedList( if ((index > list_info->elements) || (list_info->elements == list_info->capacity)) return(MagickFalse); - next=(ElementInfo *) AcquireAlignedMemory(1,sizeof(*next)); + next=(ElementInfo *) AcquireQuantumMemory(1,sizeof(*next)); if (next == (ElementInfo *) NULL) return(MagickFalse); next->value=(void *) value; @@ -1142,7 +1142,7 @@ MagickExport MagickBooleanType InsertValueInSortedLinkedList( return(MagickFalse); if (list_info->elements == list_info->capacity) return(MagickFalse); - next=(ElementInfo *) AcquireAlignedMemory(1,sizeof(*next)); + next=(ElementInfo *) AcquireQuantumMemory(1,sizeof(*next)); if (next == (ElementInfo *) NULL) return(MagickFalse); next->value=(void *) value; @@ -1350,7 +1350,7 @@ MagickExport HashmapInfo *NewHashmap(const size_t capacity, HashmapInfo *hashmap_info; - hashmap_info=(HashmapInfo *) AcquireAlignedMemory(1,sizeof(*hashmap_info)); + hashmap_info=(HashmapInfo *) AcquireQuantumMemory(1,sizeof(*hashmap_info)); if (hashmap_info == (HashmapInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(hashmap_info,0,sizeof(*hashmap_info)); @@ -1406,7 +1406,7 @@ MagickExport LinkedListInfo *NewLinkedList(const size_t capacity) LinkedListInfo *list_info; - list_info=(LinkedListInfo *) AcquireAlignedMemory(1,sizeof(*list_info)); + list_info=(LinkedListInfo *) AcquireQuantumMemory(1,sizeof(*list_info)); if (list_info == (LinkedListInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(list_info,0,sizeof(*list_info)); @@ -1551,7 +1551,7 @@ MagickExport MagickBooleanType PutEntryInHashmap(HashmapInfo *hashmap_info, (void) LogMagickEvent(TraceEvent,GetMagickModule(),"..."); if ((key == (void *) NULL) || (value == (void *) NULL)) return(MagickFalse); - next=(EntryInfo *) AcquireAlignedMemory(1,sizeof(*next)); + next=(EntryInfo *) AcquireQuantumMemory(1,sizeof(*next)); if (next == (EntryInfo *) NULL) return(MagickFalse); LockSemaphoreInfo(hashmap_info->semaphore); diff --git a/magick/histogram.c b/magick/histogram.c index ca43fd0e0..3c58d2424 100644 --- a/magick/histogram.c +++ b/magick/histogram.c @@ -483,7 +483,7 @@ static CubeInfo *GetCubeInfo(void) /* Initialize tree to describe color cube. */ - cube_info=(CubeInfo *) AcquireAlignedMemory(1,sizeof(*cube_info)); + cube_info=(CubeInfo *) AcquireQuantumMemory(1,sizeof(*cube_info)); if (cube_info == (CubeInfo *) NULL) return((CubeInfo *) NULL); (void) ResetMagickMemory(cube_info,0,sizeof(*cube_info)); @@ -594,7 +594,7 @@ static NodeInfo *GetNodeInfo(CubeInfo *cube_info,const size_t level) /* Allocate a new nodes of nodes. */ - nodes=(Nodes *) AcquireAlignedMemory(1,sizeof(*nodes)); + nodes=(Nodes *) AcquireQuantumMemory(1,sizeof(*nodes)); if (nodes == (Nodes *) NULL) return((NodeInfo *) NULL); nodes->next=cube_info->node_queue; diff --git a/magick/image-view.c b/magick/image-view.c index 1c0be0a25..29246c639 100644 --- a/magick/image-view.c +++ b/magick/image-view.c @@ -110,7 +110,7 @@ MagickExport ImageView *CloneImageView(const ImageView *image_view) assert(image_view != (ImageView *) NULL); assert(image_view->signature == MagickSignature); - clone_view=(ImageView *) AcquireAlignedMemory(1,sizeof(*clone_view)); + clone_view=(ImageView *) AcquireQuantumMemory(1,sizeof(*clone_view)); if (clone_view == (ImageView *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(clone_view,0,sizeof(*clone_view)); @@ -726,7 +726,7 @@ MagickExport ImageView *NewImageView(Image *image) assert(image != (Image *) NULL); assert(image->signature == MagickSignature); - image_view=(ImageView *) AcquireAlignedMemory(1,sizeof(*image_view)); + image_view=(ImageView *) AcquireQuantumMemory(1,sizeof(*image_view)); if (image_view == (ImageView *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(image_view,0,sizeof(*image_view)); @@ -779,7 +779,7 @@ MagickExport ImageView *NewImageViewRegion(Image *image,const ssize_t x, assert(image != (Image *) NULL); assert(image->signature == MagickSignature); - image_view=(ImageView *) AcquireAlignedMemory(1,sizeof(*image_view)); + image_view=(ImageView *) AcquireQuantumMemory(1,sizeof(*image_view)); if (image_view == (ImageView *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(image_view,0,sizeof(*image_view)); diff --git a/magick/image.c b/magick/image.c index 968141584..95342f35f 100644 --- a/magick/image.c +++ b/magick/image.c @@ -157,7 +157,7 @@ MagickExport Image *AcquireImage(const ImageInfo *image_info) Allocate image structure. */ (void) LogMagickEvent(TraceEvent,GetMagickModule(),"..."); - image=(Image *) AcquireAlignedMemory(1,sizeof(*image)); + image=(Image *) AcquireQuantumMemory(1,sizeof(*image)); if (image == (Image *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(image,0,sizeof(*image)); @@ -316,7 +316,7 @@ MagickExport ImageInfo *AcquireImageInfo(void) ImageInfo *image_info; - image_info=(ImageInfo *) AcquireAlignedMemory(1,sizeof(*image_info)); + image_info=(ImageInfo *) AcquireQuantumMemory(1,sizeof(*image_info)); if (image_info == (ImageInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); GetImageInfo(image_info); @@ -769,7 +769,7 @@ MagickExport Image *CloneImage(const Image *image,const size_t columns, (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); - clone_image=(Image *) AcquireAlignedMemory(1,sizeof(*clone_image)); + clone_image=(Image *) AcquireQuantumMemory(1,sizeof(*clone_image)); if (clone_image == (Image *) NULL) ThrowImageException(ResourceLimitError,"MemoryAllocationFailed"); (void) ResetMagickMemory(clone_image,0,sizeof(*clone_image)); diff --git a/magick/locale.c b/magick/locale.c index e8b7abe2d..34e9c1000 100644 --- a/magick/locale.c +++ b/magick/locale.c @@ -918,7 +918,7 @@ static MagickBooleanType LoadLocaleList(const char *xml,const char *filename, while ((isspace((int) ((unsigned char) *q)) != 0) && (q > p)) q--; (void) CopyMagickString(message,p,(size_t) (q-p+2)); - locale_info=(LocaleInfo *) AcquireAlignedMemory(1,sizeof(*locale_info)); + locale_info=(LocaleInfo *) AcquireQuantumMemory(1,sizeof(*locale_info)); if (locale_info == (LocaleInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(locale_info,0,sizeof(*locale_info)); diff --git a/magick/log.c b/magick/log.c index 1a37f3d9d..4bdecbe0e 100644 --- a/magick/log.c +++ b/magick/log.c @@ -1380,7 +1380,7 @@ static MagickBooleanType LoadLogList(const char *xml,const char *filename, /* Allocate memory for the log list. */ - log_info=(LogInfo *) AcquireAlignedMemory(1,sizeof(*log_info)); + log_info=(LogInfo *) AcquireQuantumMemory(1,sizeof(*log_info)); if (log_info == (LogInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(log_info,0,sizeof(*log_info)); @@ -1554,7 +1554,7 @@ static MagickBooleanType LoadLogLists(const char *filename, *p; p=LogMap+i; - log_info=(LogInfo *) AcquireAlignedMemory(1,sizeof(*log_info)); + log_info=(LogInfo *) AcquireQuantumMemory(1,sizeof(*log_info)); if (log_info == (LogInfo *) NULL) { (void) ThrowMagickException(exception,GetMagickModule(), diff --git a/magick/mac.c b/magick/mac.c index 9c8f46184..9b3ab2f1e 100644 --- a/magick/mac.c +++ b/magick/mac.c @@ -1027,7 +1027,7 @@ MagickExport DIR *opendir(const char *path) errno=error; return((DIR *) NULL); } - entry=(DIR *) AcquireAlignedMemory(1,sizeof(DIR)); + entry=(DIR *) AcquireQuantumMemory(1,sizeof(DIR)); if (entry == (DIR *) NULL) return((DIR *) NULL); entry->d_VRefNum=search_info.hFileInfo.ioVRefNum; diff --git a/magick/magic.c b/magick/magic.c index e0d7bbad9..60363a634 100644 --- a/magick/magic.c +++ b/magick/magic.c @@ -765,7 +765,7 @@ static MagickBooleanType LoadMagicList(const char *xml,const char *filename, /* Magic element. */ - magic_info=(MagicInfo *) AcquireAlignedMemory(1,sizeof(*magic_info)); + magic_info=(MagicInfo *) AcquireQuantumMemory(1,sizeof(*magic_info)); if (magic_info == (MagicInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(magic_info,0,sizeof(*magic_info)); @@ -957,7 +957,7 @@ static MagickBooleanType LoadMagicLists(const char *filename, *p; p=MagicMap+i; - magic_info=(MagicInfo *) AcquireAlignedMemory(1,sizeof(*magic_info)); + magic_info=(MagicInfo *) AcquireQuantumMemory(1,sizeof(*magic_info)); if (magic_info == (MagicInfo *) NULL) { (void) ThrowMagickException(exception,GetMagickModule(), diff --git a/magick/magick.c b/magick/magick.c index b50f20ed7..5067f38de 100644 --- a/magick/magick.c +++ b/magick/magick.c @@ -1456,7 +1456,7 @@ MagickExport MagickInfo *SetMagickInfo(const char *name) assert(name != (const char *) NULL); (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",name); - magick_info=(MagickInfo *) AcquireAlignedMemory(1,sizeof(*magick_info)); + magick_info=(MagickInfo *) AcquireQuantumMemory(1,sizeof(*magick_info)); if (magick_info == (MagickInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(magick_info,0,sizeof(*magick_info)); diff --git a/magick/memory.c b/magick/memory.c index 5b56800ac..e41a19d02 100644 --- a/magick/memory.c +++ b/magick/memory.c @@ -172,12 +172,12 @@ static MagickBooleanType % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% AcquireAlignedMemory() returns a pointer to a block of memory at least size +% AcquireQuantumMemory() returns a pointer to a block of memory at least size % bytes whose address is a multiple of 16*sizeof(void *). % -% The format of the AcquireAlignedMemory method is: +% The format of the AcquireQuantumMemory method is: % -% void *AcquireAlignedMemory(const size_t count,const size_t quantum) +% void *AcquireQuantumMemory(const size_t count,const size_t quantum) % % A description of each parameter follows: % @@ -194,7 +194,7 @@ static inline size_t MagickMax(const size_t x,const size_t y) return(y); } -MagickExport void *AcquireAlignedMemory(const size_t count,const size_t quantum) +MagickExport void *AcquireQuantumMemory(const size_t count,const size_t quantum) { size_t size; @@ -205,7 +205,7 @@ MagickExport void *AcquireAlignedMemory(const size_t count,const size_t quantum) errno=ENOMEM; return((void *) NULL); } -#if defined(MAGICKCORE_HAVE_POSIX_MEMALIGN) +#if defined(MAGICKCORE_HAVE_POSIX_MEMALIGN) && !defined(MAGICKCORE_EMBEDDABLE_SUPPORT) { void *memory; @@ -214,7 +214,7 @@ MagickExport void *AcquireAlignedMemory(const size_t count,const size_t quantum) return(memory); } #endif - return(malloc(size)); + return(malloc(MagickMax(size,AlignedSize))); } #if defined(MAGICKCORE_EMBEDDABLE_SUPPORT) @@ -703,19 +703,19 @@ MagickExport void GetMagickMemoryMethods( % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % -% RelinquishAlignedMemory() frees memory acquired with AcquireAlignedMemory() +% RelinquishMagickMemory() frees memory acquired with AcquireQuantumMemory() % or reuse. % -% The format of the RelinquishAlignedMemory method is: +% The format of the RelinquishMagickMemory method is: % -% void *RelinquishAlignedMemory(void *memory) +% void *RelinquishMagickMemory(void *memory) % % A description of each parameter follows: % % o memory: A pointer to a block of memory to free for reuse. % */ -MagickExport void *RelinquishAlignedMemory(void *memory) +MagickExport void *RelinquishMagickMemory(void *memory) { if (memory == (void *) NULL) return((void *) NULL); diff --git a/magick/mime.c b/magick/mime.c index 84963614e..da77803e3 100644 --- a/magick/mime.c +++ b/magick/mime.c @@ -814,7 +814,7 @@ static MagickBooleanType LoadMimeList(const char *xml,const char *filename, /* Process mime element. */ - mime_info=(MimeInfo *) AcquireAlignedMemory(1,sizeof(*mime_info)); + mime_info=(MimeInfo *) AcquireQuantumMemory(1,sizeof(*mime_info)); if (mime_info == (MimeInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(mime_info,0,sizeof(*mime_info)); diff --git a/magick/module.c b/magick/module.c index 3134dd0e7..422dafa6c 100644 --- a/magick/module.c +++ b/magick/module.c @@ -138,7 +138,7 @@ MagickExport ModuleInfo *AcquireModuleInfo(const char *path,const char *tag) ModuleInfo *module_info; - module_info=(ModuleInfo *) AcquireAlignedMemory(1,sizeof(*module_info)); + module_info=(ModuleInfo *) AcquireQuantumMemory(1,sizeof(*module_info)); if (module_info == (ModuleInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(module_info,0,sizeof(*module_info)); @@ -465,7 +465,7 @@ MagickExport char **GetModuleList(const char *pattern, modules=(char **) RelinquishMagickMemory(modules); return((char **) NULL); } - buffer=(struct dirent *) AcquireAlignedMemory(1,sizeof(*buffer)+ + buffer=(struct dirent *) AcquireQuantumMemory(1,sizeof(*buffer)+ FILENAME_MAX+1); if (buffer == (struct dirent *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); diff --git a/magick/montage.c b/magick/montage.c index f6c0a33ed..295207a21 100644 --- a/magick/montage.c +++ b/magick/montage.c @@ -104,7 +104,7 @@ MagickExport MontageInfo *CloneMontageInfo(const ImageInfo *image_info, MontageInfo *clone_info; - clone_info=(MontageInfo *) AcquireAlignedMemory(1,sizeof(*clone_info)); + clone_info=(MontageInfo *) AcquireQuantumMemory(1,sizeof(*clone_info)); if (clone_info == (MontageInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); GetMontageInfo(image_info,clone_info); diff --git a/magick/nt-base.c b/magick/nt-base.c index f89c9c9b7..12bba1d70 100644 --- a/magick/nt-base.c +++ b/magick/nt-base.c @@ -1380,7 +1380,7 @@ MagickExport DIR *NTOpenDirectory(const char *path) MaxTextExtent); if (length >= MaxTextExtent) return((DIR *) NULL); - entry=(DIR *) AcquireAlignedMemory(1,sizeof(DIR)); + entry=(DIR *) AcquireQuantumMemory(1,sizeof(DIR)); if (entry != (DIR *) NULL) { entry->firsttime=TRUE; diff --git a/magick/nt-feature.c b/magick/nt-feature.c index e5dd5188f..152a72808 100644 --- a/magick/nt-feature.c +++ b/magick/nt-feature.c @@ -382,7 +382,7 @@ MagickExport MagickBooleanType NTLoadTypeLists(SplayTreeInfo *type_list, continue; *pos='\0'; /* Remove (TrueType) from string */ - type_info=(TypeInfo *) AcquireAlignedMemory(1,sizeof(*type_info)); + type_info=(TypeInfo *) AcquireQuantumMemory(1,sizeof(*type_info)); if (type_info == (TypeInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(type_info,0,sizeof(TypeInfo)); diff --git a/magick/paint.c b/magick/paint.c index 78e766d2f..c2213e3a2 100644 --- a/magick/paint.c +++ b/magick/paint.c @@ -526,7 +526,7 @@ static size_t **DestroyHistogramThreadSet(size_t **histogram) for (i=0; i < (ssize_t) GetOpenMPMaximumThreads(); i++) if (histogram[i] != (size_t *) NULL) histogram[i]=(size_t *) RelinquishMagickMemory(histogram[i]); - histogram=(size_t **) RelinquishAlignedMemory(histogram); + histogram=(size_t **) RelinquishMagickMemory(histogram); return(histogram); } @@ -540,7 +540,7 @@ static size_t **AcquireHistogramThreadSet(const size_t count) number_threads; number_threads=GetOpenMPMaximumThreads(); - histogram=(size_t **) AcquireAlignedMemory(number_threads, + histogram=(size_t **) AcquireQuantumMemory(number_threads, sizeof(*histogram)); if (histogram == (size_t **) NULL) return((size_t **) NULL); diff --git a/magick/policy.c b/magick/policy.c index bb127bdfd..7263e18c4 100644 --- a/magick/policy.c +++ b/magick/policy.c @@ -747,7 +747,7 @@ static MagickBooleanType LoadPolicyList(const char *xml,const char *filename, /* Policy element. */ - policy_info=(PolicyInfo *) AcquireAlignedMemory(1,sizeof(*policy_info)); + policy_info=(PolicyInfo *) AcquireQuantumMemory(1,sizeof(*policy_info)); if (policy_info == (PolicyInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(policy_info,0,sizeof(*policy_info)); @@ -908,7 +908,7 @@ static MagickBooleanType LoadPolicyLists(const char *filename, *p; p=PolicyMap+i; - policy_info=(PolicyInfo *) AcquireAlignedMemory(1,sizeof(*policy_info)); + policy_info=(PolicyInfo *) AcquireQuantumMemory(1,sizeof(*policy_info)); if (policy_info == (PolicyInfo *) NULL) { (void) ThrowMagickException(exception,GetMagickModule(), diff --git a/magick/profile.c b/magick/profile.c index 213d0f91d..d2a9e0f74 100644 --- a/magick/profile.c +++ b/magick/profile.c @@ -349,7 +349,7 @@ static unsigned short **DestroyPixelThreadSet(unsigned short **pixels) for (i=0; i < (ssize_t) GetOpenMPMaximumThreads(); i++) if (pixels[i] != (unsigned short *) NULL) pixels[i]=(unsigned short *) RelinquishMagickMemory(pixels[i]); - pixels=(unsigned short **) RelinquishAlignedMemory(pixels); + pixels=(unsigned short **) RelinquishMagickMemory(pixels); return(pixels); } @@ -366,7 +366,7 @@ static unsigned short **AcquirePixelThreadSet(const size_t columns, number_threads; number_threads=GetOpenMPMaximumThreads(); - pixels=(unsigned short **) AcquireAlignedMemory(number_threads, + pixels=(unsigned short **) AcquireQuantumMemory(number_threads, sizeof(*pixels)); if (pixels == (unsigned short **) NULL) return((unsigned short **) NULL); @@ -390,7 +390,7 @@ static cmsHTRANSFORM *DestroyTransformThreadSet(cmsHTRANSFORM *transform) for (i=0; i < (ssize_t) GetOpenMPMaximumThreads(); i++) if (transform[i] != (cmsHTRANSFORM) NULL) cmsDeleteTransform(transform[i]); - transform=(cmsHTRANSFORM *) RelinquishAlignedMemory(transform); + transform=(cmsHTRANSFORM *) RelinquishMagickMemory(transform); return(transform); } @@ -409,7 +409,7 @@ static cmsHTRANSFORM *AcquireTransformThreadSet(Image *image, number_threads; number_threads=GetOpenMPMaximumThreads(); - transform=(cmsHTRANSFORM *) AcquireAlignedMemory(number_threads, + transform=(cmsHTRANSFORM *) AcquireQuantumMemory(number_threads, sizeof(*transform)); if (transform == (cmsHTRANSFORM *) NULL) return((cmsHTRANSFORM *) NULL); diff --git a/magick/quantize.c b/magick/quantize.c index c6255f0a4..fb1aa0f4f 100644 --- a/magick/quantize.c +++ b/magick/quantize.c @@ -366,7 +366,7 @@ MagickExport QuantizeInfo *AcquireQuantizeInfo(const ImageInfo *image_info) QuantizeInfo *quantize_info; - quantize_info=(QuantizeInfo *) AcquireAlignedMemory(1,sizeof(*quantize_info)); + quantize_info=(QuantizeInfo *) AcquireQuantumMemory(1,sizeof(*quantize_info)); if (quantize_info == (QuantizeInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); GetQuantizeInfo(quantize_info); @@ -977,7 +977,7 @@ MagickExport QuantizeInfo *CloneQuantizeInfo(const QuantizeInfo *quantize_info) QuantizeInfo *clone_info; - clone_info=(QuantizeInfo *) AcquireAlignedMemory(1,sizeof(*clone_info)); + clone_info=(QuantizeInfo *) AcquireQuantumMemory(1,sizeof(*clone_info)); if (clone_info == (QuantizeInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); GetQuantizeInfo(clone_info); @@ -1861,7 +1861,7 @@ static CubeInfo *GetCubeInfo(const QuantizeInfo *quantize_info, /* Initialize tree to describe color cube_info. */ - cube_info=(CubeInfo *) AcquireAlignedMemory(1,sizeof(*cube_info)); + cube_info=(CubeInfo *) AcquireQuantumMemory(1,sizeof(*cube_info)); if (cube_info == (CubeInfo *) NULL) return((CubeInfo *) NULL); (void) ResetMagickMemory(cube_info,0,sizeof(*cube_info)); @@ -1961,7 +1961,7 @@ static NodeInfo *GetNodeInfo(CubeInfo *cube_info,const size_t id, /* Allocate a new queue of nodes. */ - nodes=(Nodes *) AcquireAlignedMemory(1,sizeof(*nodes)); + nodes=(Nodes *) AcquireQuantumMemory(1,sizeof(*nodes)); if (nodes == (Nodes *) NULL) return((NodeInfo *) NULL); nodes->nodes=(NodeInfo *) AcquireQuantumMemory(NodesInAList, diff --git a/magick/quantum.c b/magick/quantum.c index 954eda85c..970a38d1f 100644 --- a/magick/quantum.c +++ b/magick/quantum.c @@ -120,7 +120,7 @@ MagickExport QuantumInfo *AcquireQuantumInfo(const ImageInfo *image_info, QuantumInfo *quantum_info; - quantum_info=(QuantumInfo *) AcquireAlignedMemory(1,sizeof(*quantum_info)); + quantum_info=(QuantumInfo *) AcquireQuantumMemory(1,sizeof(*quantum_info)); if (quantum_info == (QuantumInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); quantum_info->signature=MagickSignature; diff --git a/magick/random.c b/magick/random.c index f7f33d0b9..7046f3c26 100644 --- a/magick/random.c +++ b/magick/random.c @@ -172,7 +172,7 @@ MagickExport RandomInfo *AcquireRandomInfo(void) *key, *nonce; - random_info=(RandomInfo *) AcquireAlignedMemory(1,sizeof(*random_info)); + random_info=(RandomInfo *) AcquireQuantumMemory(1,sizeof(*random_info)); if (random_info == (RandomInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(random_info,0,sizeof(*random_info)); @@ -287,7 +287,7 @@ MagickExport RandomInfo *DestroyRandomInfo(RandomInfo *random_info) random_info->signature=(~MagickSignature); UnlockSemaphoreInfo(random_info->semaphore); DestroySemaphoreInfo(&random_info->semaphore); - random_info=(RandomInfo *) RelinquishAlignedMemory(random_info); + random_info=(RandomInfo *) RelinquishMagickMemory(random_info); return(random_info); } diff --git a/magick/registry.c b/magick/registry.c index 2976362e6..b17cdf450 100644 --- a/magick/registry.c +++ b/magick/registry.c @@ -514,7 +514,7 @@ MagickExport MagickBooleanType SetImageRegistry(const RegistryType type, } if (clone_value == (void *) NULL) return(MagickFalse); - registry_info=(RegistryInfo *) AcquireAlignedMemory(1,sizeof(*registry_info)); + registry_info=(RegistryInfo *) AcquireQuantumMemory(1,sizeof(*registry_info)); if (registry_info == (RegistryInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(registry_info,0,sizeof(*registry_info)); diff --git a/magick/resize.c b/magick/resize.c index ab98df09f..3e81fe116 100644 --- a/magick/resize.c +++ b/magick/resize.c @@ -759,7 +759,7 @@ MagickExport ResizeFilter *AcquireResizeFilter(const Image *image, assert(UndefinedFilter < filter && filter < SentinelFilter); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); - resize_filter=(ResizeFilter *) AcquireAlignedMemory(1,sizeof(*resize_filter)); + resize_filter=(ResizeFilter *) AcquireQuantumMemory(1,sizeof(*resize_filter)); if (resize_filter == (ResizeFilter *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); /* @@ -1883,7 +1883,7 @@ static ContributionInfo **DestroyContributionThreadSet( if (contribution[i] != (ContributionInfo *) NULL) contribution[i]=(ContributionInfo *) RelinquishMagickMemory( contribution[i]); - contribution=(ContributionInfo **) RelinquishAlignedMemory(contribution); + contribution=(ContributionInfo **) RelinquishMagickMemory(contribution); return(contribution); } @@ -1899,7 +1899,7 @@ static ContributionInfo **AcquireContributionThreadSet(const size_t count) number_threads; number_threads=GetOpenMPMaximumThreads(); - contribution=(ContributionInfo **) AcquireAlignedMemory(number_threads, + contribution=(ContributionInfo **) AcquireQuantumMemory(number_threads, sizeof(*contribution)); if (contribution == (ContributionInfo **) NULL) return((ContributionInfo **) NULL); diff --git a/magick/segment.c b/magick/segment.c index c6dec075b..e2b90cdf5 100644 --- a/magick/segment.c +++ b/magick/segment.c @@ -308,7 +308,7 @@ static MagickBooleanType Classify(Image *image,short **extrema, } else { - cluster=(Cluster *) AcquireAlignedMemory(1,sizeof(*cluster)); + cluster=(Cluster *) AcquireQuantumMemory(1,sizeof(*cluster)); head=cluster; } if (cluster == (Cluster *) NULL) @@ -330,7 +330,7 @@ static MagickBooleanType Classify(Image *image,short **extrema, /* No classes were identified-- create one. */ - cluster=(Cluster *) AcquireAlignedMemory(1,sizeof(*cluster)); + cluster=(Cluster *) AcquireQuantumMemory(1,sizeof(*cluster)); if (cluster == (Cluster *) NULL) ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed", image->filename); @@ -1040,7 +1040,7 @@ MagickExport MagickBooleanType GetImageDynamicThreshold(const Image *image, } else { - cluster=(Cluster *) AcquireAlignedMemory(1,sizeof(*cluster)); + cluster=(Cluster *) AcquireQuantumMemory(1,sizeof(*cluster)); head=cluster; } if (cluster == (Cluster *) NULL) @@ -1066,7 +1066,7 @@ MagickExport MagickBooleanType GetImageDynamicThreshold(const Image *image, /* No classes were identified-- create one. */ - cluster=(Cluster *) AcquireAlignedMemory(1,sizeof(*cluster)); + cluster=(Cluster *) AcquireQuantumMemory(1,sizeof(*cluster)); if (cluster == (Cluster *) NULL) { (void) ThrowMagickException(exception,GetMagickModule(), @@ -1376,7 +1376,7 @@ static IntervalTree *InitializeIntervalTree(const ZeroCrossing *zero_crossing, /* The root is the entire histogram. */ - root=(IntervalTree *) AcquireAlignedMemory(1,sizeof(*root)); + root=(IntervalTree *) AcquireQuantumMemory(1,sizeof(*root)); root->child=(IntervalTree *) NULL; root->sibling=(IntervalTree *) NULL; root->tau=0.0; diff --git a/magick/shear.c b/magick/shear.c index 58a217d43..17be2b837 100644 --- a/magick/shear.c +++ b/magick/shear.c @@ -369,7 +369,7 @@ static RadonInfo *AcquireRadonInfo(const Image *image,const size_t width, RadonInfo *radon_info; - radon_info=(RadonInfo *) AcquireAlignedMemory(1,sizeof(*radon_info)); + radon_info=(RadonInfo *) AcquireQuantumMemory(1,sizeof(*radon_info)); if (radon_info == (RadonInfo *) NULL) return((RadonInfo *) NULL); (void) ResetMagickMemory(radon_info,0,sizeof(*radon_info)); diff --git a/magick/signature.c b/magick/signature.c index 1a7d0007d..dc4b4d838 100644 --- a/magick/signature.c +++ b/magick/signature.c @@ -120,7 +120,7 @@ MagickExport SignatureInfo *AcquireSignatureInfo(void) unsigned int lsb_first; - signature_info=(SignatureInfo *) AcquireAlignedMemory(1,sizeof(*signature_info)); + signature_info=(SignatureInfo *) AcquireQuantumMemory(1,sizeof(*signature_info)); if (signature_info == (SignatureInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(signature_info,0,sizeof(*signature_info)); diff --git a/magick/splay-tree.c b/magick/splay-tree.c index 08e8118ac..96778c425 100644 --- a/magick/splay-tree.c +++ b/magick/splay-tree.c @@ -182,7 +182,7 @@ MagickExport MagickBooleanType AddValueToSplayTree(SplayTreeInfo *splay_tree, return(MagickTrue); } } - node=(NodeInfo *) AcquireAlignedMemory(1,sizeof(*node)); + node=(NodeInfo *) AcquireQuantumMemory(1,sizeof(*node)); if (node == (NodeInfo *) NULL) { UnlockSemaphoreInfo(splay_tree->semaphore); @@ -1098,7 +1098,7 @@ MagickExport SplayTreeInfo *NewSplayTree( SplayTreeInfo *splay_tree; - splay_tree=(SplayTreeInfo *) AcquireAlignedMemory(1,sizeof(*splay_tree)); + splay_tree=(SplayTreeInfo *) AcquireQuantumMemory(1,sizeof(*splay_tree)); if (splay_tree == (SplayTreeInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(splay_tree,0,sizeof(*splay_tree)); diff --git a/magick/statistic.c b/magick/statistic.c index f4b261fd7..d44fd0909 100644 --- a/magick/statistic.c +++ b/magick/statistic.c @@ -141,7 +141,7 @@ static MagickPixelPacket **DestroyPixelThreadSet(MagickPixelPacket **pixels) for (i=0; i < (ssize_t) GetOpenMPMaximumThreads(); i++) if (pixels[i] != (MagickPixelPacket *) NULL) pixels[i]=(MagickPixelPacket *) RelinquishMagickMemory(pixels[i]); - pixels=(MagickPixelPacket **) RelinquishAlignedMemory(pixels); + pixels=(MagickPixelPacket **) RelinquishMagickMemory(pixels); return(pixels); } @@ -158,7 +158,7 @@ static MagickPixelPacket **AcquirePixelThreadSet(const Image *image) number_threads; number_threads=GetOpenMPMaximumThreads(); - pixels=(MagickPixelPacket **) AcquireAlignedMemory(number_threads, + pixels=(MagickPixelPacket **) AcquireQuantumMemory(number_threads, sizeof(*pixels)); if (pixels == (MagickPixelPacket **) NULL) return((MagickPixelPacket **) NULL); diff --git a/magick/stream.c b/magick/stream.c index 6b5da155c..936e879ae 100644 --- a/magick/stream.c +++ b/magick/stream.c @@ -152,7 +152,7 @@ MagickExport StreamInfo *AcquireStreamInfo(const ImageInfo *image_info) StreamInfo *stream_info; - stream_info=(StreamInfo *) AcquireAlignedMemory(1,sizeof(*stream_info)); + stream_info=(StreamInfo *) AcquireQuantumMemory(1,sizeof(*stream_info)); if (stream_info == (StreamInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(stream_info,0,sizeof(*stream_info)); diff --git a/magick/string.c b/magick/string.c index 50814d629..5cc341ce8 100644 --- a/magick/string.c +++ b/magick/string.c @@ -158,7 +158,7 @@ MagickExport StringInfo *AcquireStringInfo(const size_t length) StringInfo *string_info; - string_info=(StringInfo *) AcquireAlignedMemory(1,sizeof(*string_info)); + string_info=(StringInfo *) AcquireQuantumMemory(1,sizeof(*string_info)); if (string_info == (StringInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(string_info,0,sizeof(*string_info)); diff --git a/magick/thread.c b/magick/thread.c index e3126447f..5b76062fe 100644 --- a/magick/thread.c +++ b/magick/thread.c @@ -69,7 +69,7 @@ MagickExport MagickBooleanType MagickCreateThreadKey(MagickThreadKey *key) *key=TlsAlloc(); return(*key != TLS_OUT_OF_INDEXES ? MagickTrue : MagickFalse); #else - *key=AcquireAlignedMemory(1,sizeof(key)); + *key=AcquireQuantumMemory(1,sizeof(key)); return(*key != (void *) NULL ? MagickTrue : MagickFalse); #endif } diff --git a/magick/threshold.c b/magick/threshold.c index 1c4bf1697..b581498d2 100644 --- a/magick/threshold.c +++ b/magick/threshold.c @@ -933,7 +933,7 @@ MagickExport ThresholdMap *GetThresholdMapFile(const char *xml, } /* The map has been found -- Allocate a Threshold Map to return */ - map = (ThresholdMap *)AcquireAlignedMemory(1,sizeof(ThresholdMap)); + map = (ThresholdMap *)AcquireQuantumMemory(1,sizeof(ThresholdMap)); if ( map == (ThresholdMap *)NULL ) ThrowFatalException(ResourceLimitFatalError,"UnableToAcquireThresholdMap"); map->map_id = (char *)NULL; diff --git a/magick/timer.c b/magick/timer.c index ac8e36618..48451a600 100644 --- a/magick/timer.c +++ b/magick/timer.c @@ -90,7 +90,7 @@ MagickExport TimerInfo *AcquireTimerInfo(void) TimerInfo *timer_info; - timer_info=(TimerInfo *) AcquireAlignedMemory(1,sizeof(*timer_info)); + timer_info=(TimerInfo *) AcquireQuantumMemory(1,sizeof(*timer_info)); if (timer_info == (TimerInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"UnableToAcquireString"); (void) ResetMagickMemory(timer_info,0,sizeof(*timer_info)); diff --git a/magick/token.c b/magick/token.c index 79774a3a3..67d3c3920 100644 --- a/magick/token.c +++ b/magick/token.c @@ -94,7 +94,7 @@ MagickExport TokenInfo *AcquireTokenInfo(void) TokenInfo *token_info; - token_info=(TokenInfo *) AcquireAlignedMemory(1,sizeof(*token_info)); + token_info=(TokenInfo *) AcquireQuantumMemory(1,sizeof(*token_info)); if (token_info == (TokenInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); token_info->signature=MagickSignature; diff --git a/magick/type.c b/magick/type.c index 6efa28630..4fb660507 100644 --- a/magick/type.c +++ b/magick/type.c @@ -695,7 +695,7 @@ MagickExport MagickBooleanType LoadFontConfigFonts(SplayTreeInfo *type_list, GetPathComponent((const char *) file,ExtensionPath,extension); if ((*extension != '\0') && (LocaleCompare(extension,"gz") == 0)) continue; - type_info=(TypeInfo *) AcquireAlignedMemory(1,sizeof(*type_info)); + type_info=(TypeInfo *) AcquireQuantumMemory(1,sizeof(*type_info)); if (type_info == (TypeInfo *) NULL) continue; (void) ResetMagickMemory(type_info,0,sizeof(*type_info)); @@ -1064,7 +1064,7 @@ static MagickBooleanType LoadTypeList(const char *xml,const char *filename, /* Type element. */ - type_info=(TypeInfo *) AcquireAlignedMemory(1,sizeof(*type_info)); + type_info=(TypeInfo *) AcquireQuantumMemory(1,sizeof(*type_info)); if (type_info == (TypeInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(type_info,0,sizeof(*type_info)); diff --git a/magick/utility.c b/magick/utility.c index f1a350baa..7539a9684 100644 --- a/magick/utility.c +++ b/magick/utility.c @@ -1722,7 +1722,7 @@ MagickExport char **ListFiles(const char *directory,const char *pattern, /* Save the current and change to the new directory. */ - buffer=(struct dirent *) AcquireAlignedMemory(1,sizeof(*buffer)+ + buffer=(struct dirent *) AcquireQuantumMemory(1,sizeof(*buffer)+ FILENAME_MAX+1); if (buffer == (struct dirent *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); diff --git a/magick/vms.c b/magick/vms.c index 150e54444..663a53e24 100644 --- a/magick/vms.c +++ b/magick/vms.c @@ -111,7 +111,7 @@ DIR *opendir(char *name) /* Allocate memory for handle and the pattern. */ - directory=(DIR *) AcquireAlignedMemory(1,sizeof(DIR)); + directory=(DIR *) AcquireQuantumMemory(1,sizeof(DIR)); if (directory == (DIR *) NULL) { errno=ENOMEM; diff --git a/magick/xml-tree.c b/magick/xml-tree.c index ccc34fa61..5cf2a3bb0 100644 --- a/magick/xml-tree.c +++ b/magick/xml-tree.c @@ -167,7 +167,7 @@ MagickExport XMLTreeInfo *AddChildToXMLTree(XMLTreeInfo *xml_info, if (xml_info == (XMLTreeInfo *) NULL) return((XMLTreeInfo *) NULL); - child=(XMLTreeInfo *) AcquireAlignedMemory(1,sizeof(*child)); + child=(XMLTreeInfo *) AcquireQuantumMemory(1,sizeof(*child)); if (child == (XMLTreeInfo *) NULL) return((XMLTreeInfo *) NULL); (void) ResetMagickMemory(child,0,sizeof(*child)); @@ -1420,7 +1420,7 @@ static void ParseProcessingInstructions(XMLTreeRoot *root,char *xml, } if (root->processing_instructions[0] == (char **) NULL) { - root->processing_instructions=(char ***) AcquireAlignedMemory(1,sizeof( + root->processing_instructions=(char ***) AcquireQuantumMemory(1,sizeof( *root->processing_instructions)); if (root->processing_instructions ==(char ***) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); @@ -1486,7 +1486,7 @@ static MagickBooleanType ParseInternalDoctype(XMLTreeRoot *root,char *xml, i; n=(char *) NULL; - predefined_entitites=(char **) AcquireAlignedMemory(1,sizeof(sentinel)); + predefined_entitites=(char **) AcquireQuantumMemory(1,sizeof(sentinel)); if (predefined_entitites == (char **) NULL) ThrowFatalException(ResourceLimitError,"MemoryAllocationFailed"); (void) CopyMagickMemory(predefined_entitites,sentinel,sizeof(sentinel)); @@ -2086,7 +2086,7 @@ MagickExport XMLTreeInfo *NewXMLTreeTag(const char *tag) XMLTreeRoot *root; - root=(XMLTreeRoot *) AcquireAlignedMemory(1,sizeof(*root)); + root=(XMLTreeRoot *) AcquireQuantumMemory(1,sizeof(*root)); if (root == (XMLTreeRoot *) NULL) return((XMLTreeInfo *) NULL); (void) ResetMagickMemory(root,0,sizeof(*root)); @@ -2095,7 +2095,7 @@ MagickExport XMLTreeInfo *NewXMLTreeTag(const char *tag) root->root.tag=ConstantString(tag); root->node=(&root->root); root->root.content=ConstantString(""); - root->entities=(char **) AcquireAlignedMemory(1,sizeof(predefined_entities)); + root->entities=(char **) AcquireQuantumMemory(1,sizeof(predefined_entities)); if (root->entities == (char **) NULL) return((XMLTreeInfo *) NULL); (void) CopyMagickMemory(root->entities,predefined_entities, diff --git a/magick/xwindow.c b/magick/xwindow.c index bca60ebe2..3121aa59c 100644 --- a/magick/xwindow.c +++ b/magick/xwindow.c @@ -4265,7 +4265,7 @@ static Image *XGetWindowImage(Display *display,const Window window, /* Append colormap to colormap list. */ - p=(ColormapInfo *) AcquireAlignedMemory(1,sizeof(*p)); + p=(ColormapInfo *) AcquireQuantumMemory(1,sizeof(*p)); if (p == (ColormapInfo *) NULL) return((Image *) NULL); p->colormap=window_info[id].colormap; @@ -5078,7 +5078,7 @@ MagickExport XWindows *XInitializeWindows(Display *display, /* Allocate windows structure. */ - windows=(XWindows *) AcquireAlignedMemory(1,sizeof(*windows)); + windows=(XWindows *) AcquireQuantumMemory(1,sizeof(*windows)); if (windows == (XWindows *) NULL) { ThrowXWindowFatalException(XServerFatalError,"MemoryAllocationFailed", diff --git a/wand/deprecate.c b/wand/deprecate.c index 36ba26ba5..44db73469 100644 --- a/wand/deprecate.c +++ b/wand/deprecate.c @@ -129,7 +129,7 @@ static MagickWand *CloneMagickWandFromImages(const MagickWand *wand, assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - clone_wand=(MagickWand *) AcquireAlignedMemory(1,sizeof(*clone_wand)); + clone_wand=(MagickWand *) AcquireQuantumMemory(1,sizeof(*clone_wand)); if (clone_wand == (MagickWand *) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", images->filename); @@ -201,7 +201,7 @@ WandExport PixelView *ClonePixelView(const PixelView *pixel_view) assert(pixel_view->signature == WandSignature); if (pixel_view->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",pixel_view->name); - clone_view=(PixelView *) AcquireAlignedMemory(1,sizeof(*clone_view)); + clone_view=(PixelView *) AcquireQuantumMemory(1,sizeof(*clone_view)); if (clone_view == (PixelView *) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", pixel_view->name); @@ -262,7 +262,7 @@ static PixelWand ***DestroyPixelsThreadSet(PixelWand ***pixel_wands, for (i=0; i < (ssize_t) number_threads; i++) if (pixel_wands[i] != (PixelWand **) NULL) pixel_wands[i]=DestroyPixelWands(pixel_wands[i],number_wands); - pixel_wands=(PixelWand ***) RelinquishAlignedMemory(pixel_wands); + pixel_wands=(PixelWand ***) RelinquishMagickMemory(pixel_wands); return(pixel_wands); } @@ -2332,7 +2332,7 @@ static PixelWand ***AcquirePixelsThreadSet(const size_t number_wands, register ssize_t i; - pixel_wands=(PixelWand ***) AcquireAlignedMemory(number_threads, + pixel_wands=(PixelWand ***) AcquireQuantumMemory(number_threads, sizeof(*pixel_wands)); if (pixel_wands == (PixelWand ***) NULL) return((PixelWand ***) NULL); @@ -2353,7 +2353,7 @@ WandExport PixelView *NewPixelView(MagickWand *wand) assert(wand != (MagickWand *) NULL); assert(wand->signature == MagickSignature); - pixel_view=(PixelView *) AcquireAlignedMemory(1,sizeof(*pixel_view)); + pixel_view=(PixelView *) AcquireQuantumMemory(1,sizeof(*pixel_view)); if (pixel_view == (PixelView *) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", GetExceptionMessage(errno)); @@ -2412,7 +2412,7 @@ WandExport PixelView *NewPixelViewRegion(MagickWand *wand,const ssize_t x, assert(wand != (MagickWand *) NULL); assert(wand->signature == MagickSignature); - pixel_view=(PixelView *) AcquireAlignedMemory(1,sizeof(*pixel_view)); + pixel_view=(PixelView *) AcquireQuantumMemory(1,sizeof(*pixel_view)); if (pixel_view == (PixelView *) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", GetExceptionMessage(errno)); diff --git a/wand/drawing-wand.c b/wand/drawing-wand.c index e7eccec36..64b1e2b78 100644 --- a/wand/drawing-wand.c +++ b/wand/drawing-wand.c @@ -556,7 +556,7 @@ WandExport DrawingWand *CloneDrawingWand(const DrawingWand *wand) assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - clone_wand=(DrawingWand *) AcquireAlignedMemory(1,sizeof(*clone_wand)); + clone_wand=(DrawingWand *) AcquireQuantumMemory(1,sizeof(*clone_wand)); if (clone_wand == (DrawingWand *) NULL) ThrowWandFatalException(ResourceLimitFatalError, "MemoryAllocationFailed",GetExceptionMessage(errno)); @@ -6578,7 +6578,7 @@ WandExport DrawingWand *NewDrawingWand(void) quantum=GetMagickQuantumDepth(&depth); if (depth != MAGICKCORE_QUANTUM_DEPTH) ThrowWandFatalException(WandError,"QuantumDepthMismatch",quantum); - wand=(DrawingWand *) AcquireAlignedMemory(1,sizeof(*wand)); + wand=(DrawingWand *) AcquireQuantumMemory(1,sizeof(*wand)); if (wand == (DrawingWand *) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", GetExceptionMessage(errno)); @@ -6599,7 +6599,7 @@ WandExport DrawingWand *NewDrawingWand(void) wand->pattern_bounds.width=0; wand->pattern_bounds.height=0; wand->index=0; - wand->graphic_context=(DrawInfo **) AcquireAlignedMemory(1,sizeof( + wand->graphic_context=(DrawInfo **) AcquireQuantumMemory(1,sizeof( *wand->graphic_context)); if (wand->graphic_context == (DrawInfo **) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", diff --git a/wand/magick-image.c b/wand/magick-image.c index 26ec38fc8..c66597451 100644 --- a/wand/magick-image.c +++ b/wand/magick-image.c @@ -99,7 +99,7 @@ static MagickWand *CloneMagickWandFromImages(const MagickWand *wand, assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - clone_wand=(MagickWand *) AcquireAlignedMemory(1,sizeof(*clone_wand)); + clone_wand=(MagickWand *) AcquireQuantumMemory(1,sizeof(*clone_wand)); if (clone_wand == (MagickWand *) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", images->filename); diff --git a/wand/magick-wand.c b/wand/magick-wand.c index ea9ee863f..a7579773d 100644 --- a/wand/magick-wand.c +++ b/wand/magick-wand.c @@ -129,7 +129,7 @@ WandExport MagickWand *CloneMagickWand(const MagickWand *wand) assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - clone_wand=(MagickWand *) AcquireAlignedMemory(1,sizeof(*clone_wand)); + clone_wand=(MagickWand *) AcquireQuantumMemory(1,sizeof(*clone_wand)); if (clone_wand == (MagickWand *) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", wand->name); @@ -1028,7 +1028,7 @@ WandExport MagickWand *NewMagickWand(void) quantum=GetMagickQuantumDepth(&depth); if (depth != MAGICKCORE_QUANTUM_DEPTH) ThrowWandFatalException(WandError,"QuantumDepthMismatch",quantum); - wand=(MagickWand *) AcquireAlignedMemory(1,sizeof(*wand)); + wand=(MagickWand *) AcquireQuantumMemory(1,sizeof(*wand)); if (wand == (MagickWand *) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", GetExceptionMessage(errno)); diff --git a/wand/pixel-iterator.c b/wand/pixel-iterator.c index 6ee213ac4..d17126174 100644 --- a/wand/pixel-iterator.c +++ b/wand/pixel-iterator.c @@ -162,7 +162,7 @@ WandExport PixelIterator *ClonePixelIterator(const PixelIterator *iterator) assert(iterator->signature == WandSignature); if (iterator->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name); - clone_iterator=(PixelIterator *) AcquireAlignedMemory(1, + clone_iterator=(PixelIterator *) AcquireQuantumMemory(1, sizeof(*clone_iterator)); if (clone_iterator == (PixelIterator *) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", @@ -313,7 +313,7 @@ WandExport PixelIterator *NewPixelIterator(MagickWand *wand) view=AcquireCacheView(image); if (view == (CacheView *) NULL) return((PixelIterator *) NULL); - iterator=(PixelIterator *) AcquireAlignedMemory(1,sizeof(*iterator)); + iterator=(PixelIterator *) AcquireQuantumMemory(1,sizeof(*iterator)); if (iterator == (PixelIterator *) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", GetExceptionMessage(errno)); @@ -428,7 +428,7 @@ WandExport PixelIterator *NewPixelRegionIterator(MagickWand *wand, view=AcquireCacheView(image); if (view == (CacheView *) NULL) return((PixelIterator *) NULL); - iterator=(PixelIterator *) AcquireAlignedMemory(1,sizeof(*iterator)); + iterator=(PixelIterator *) AcquireQuantumMemory(1,sizeof(*iterator)); if (iterator == (PixelIterator *) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", wand->name); diff --git a/wand/pixel-wand.c b/wand/pixel-wand.c index 862704ed6..617f5f94f 100644 --- a/wand/pixel-wand.c +++ b/wand/pixel-wand.c @@ -148,7 +148,7 @@ WandExport PixelWand *ClonePixelWand(const PixelWand *wand) assert(wand->signature == WandSignature); if (wand->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name); - clone_wand=(PixelWand *) AcquireAlignedMemory(1,sizeof(*clone_wand)); + clone_wand=(PixelWand *) AcquireQuantumMemory(1,sizeof(*clone_wand)); if (clone_wand == (PixelWand *) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", wand->name); @@ -400,7 +400,7 @@ WandExport PixelWand *NewPixelWand(void) quantum=GetMagickQuantumDepth(&depth); if (depth != MAGICKCORE_QUANTUM_DEPTH) ThrowWandFatalException(WandError,"QuantumDepthMismatch",quantum); - wand=(PixelWand *) AcquireAlignedMemory(1,sizeof(*wand)); + wand=(PixelWand *) AcquireQuantumMemory(1,sizeof(*wand)); if (wand == (PixelWand *) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", GetExceptionMessage(errno)); diff --git a/wand/wand-view.c b/wand/wand-view.c index f66ace021..cded62e9e 100644 --- a/wand/wand-view.c +++ b/wand/wand-view.c @@ -127,7 +127,7 @@ WandExport WandView *CloneWandView(const WandView *wand_view) assert(wand_view->signature == WandSignature); if (wand_view->debug != MagickFalse) (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand_view->name); - clone_view=(WandView *) AcquireAlignedMemory(1,sizeof(*clone_view)); + clone_view=(WandView *) AcquireQuantumMemory(1,sizeof(*clone_view)); if (clone_view == (WandView *) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", wand_view->name); @@ -184,7 +184,7 @@ static PixelWand ***DestroyPixelsThreadSet(PixelWand ***pixel_wands, for (i=0; i < (ssize_t) number_threads; i++) if (pixel_wands[i] != (PixelWand **) NULL) pixel_wands[i]=DestroyPixelWands(pixel_wands[i],number_wands); - pixel_wands=(PixelWand ***) RelinquishAlignedMemory(pixel_wands); + pixel_wands=(PixelWand ***) RelinquishMagickMemory(pixel_wands); return(pixel_wands); } @@ -738,7 +738,7 @@ static PixelWand ***AcquirePixelsThreadSet(const size_t number_wands, register ssize_t i; - pixel_wands=(PixelWand ***) AcquireAlignedMemory(number_threads, + pixel_wands=(PixelWand ***) AcquireQuantumMemory(number_threads, sizeof(*pixel_wands)); if (pixel_wands == (PixelWand ***) NULL) return((PixelWand ***) NULL); @@ -759,7 +759,7 @@ WandExport WandView *NewWandView(MagickWand *wand) assert(wand != (MagickWand *) NULL); assert(wand->signature == WandSignature); - wand_view=(WandView *) AcquireAlignedMemory(1,sizeof(*wand_view)); + wand_view=(WandView *) AcquireQuantumMemory(1,sizeof(*wand_view)); if (wand_view == (WandView *) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", GetExceptionMessage(errno)); @@ -819,7 +819,7 @@ WandExport WandView *NewWandViewExtent(MagickWand *wand,const ssize_t x, assert(wand != (MagickWand *) NULL); assert(wand->signature == WandSignature); - wand_view=(WandView *) AcquireAlignedMemory(1,sizeof(*wand_view)); + wand_view=(WandView *) AcquireQuantumMemory(1,sizeof(*wand_view)); if (wand_view == (WandView *) NULL) ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed", GetExceptionMessage(errno));