prefer AcquireQuantumMemory() over ResizeMagickMemory()
diff --git a/coders/dcm.c b/coders/dcm.c
index 447f289..dd74ed8 100644
--- a/coders/dcm.c
+++ b/coders/dcm.c
@@ -3113,7 +3113,7 @@
redmap=(int *) NULL;
greenmap=(int *) NULL;
bluemap=(int *) NULL;
- stream_info=(DCMStreamInfo *) AcquireMagickMemory(sizeof(*stream_info));
+ stream_info=(DCMStreamInfo *) AcquireQuantumMemory(1,sizeof(*stream_info));
sequence_depth=0;
stack = NewLinkedList(256);
if (stream_info == (DCMStreamInfo *) NULL)
@@ -3245,7 +3245,7 @@
*/
if (strcmp(explicit_vr,"SQ") == 0)
{
- info_copy=(DCMInfo *) AcquireMagickMemory(sizeof(info));
+ info_copy=(DCMInfo *) AcquireQuantumMemory(1,sizeof(info));
memcpy(info_copy,&info,sizeof(info));
AppendValueToLinkedList(stack,info_copy);
sequence_depth++;
diff --git a/coders/djvu.c b/coders/djvu.c
index 881515c..1bc97bd 100644
--- a/coders/djvu.c
+++ b/coders/djvu.c
@@ -801,7 +801,7 @@
/*
* Allocate a LoadContext structure.
*/
- lc = (LoadContext *) AcquireMagickMemory(sizeof(*lc));
+ lc = (LoadContext *) AcquireQuantumMemory(1,sizeof(*lc));
if (lc == NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
diff --git a/coders/flif.c b/coders/flif.c
index 9b1af42..dcb3778 100644
--- a/coders/flif.c
+++ b/coders/flif.c
@@ -179,7 +179,7 @@
image_count=flif_decoder_num_images(flifdec);
flifimage=flif_decoder_get_image(flifdec,0);
length=sizeof(unsigned short)*4*flif_image_get_width(flifimage);
- pixels=(unsigned short *) AcquireMagickMemory(length);
+ pixels=(unsigned short *) AcquireQuantumMemory(1,length);
if (pixels == (unsigned short *) NULL)
{
flif_destroy_decoder(flifdec);
diff --git a/coders/gif.c b/coders/gif.c
index 7ebb359..f17b19d 100644
--- a/coders/gif.c
+++ b/coders/gif.c
@@ -208,7 +208,7 @@
size_t
one;
- lzw_info=(LZWInfo *) AcquireMagickMemory(sizeof(*lzw_info));
+ lzw_info=(LZWInfo *) AcquireQuantumMemory(1,sizeof(*lzw_info));
if (lzw_info == (LZWInfo *) NULL)
return((LZWInfo *) NULL);
(void) memset(lzw_info,0,sizeof(*lzw_info));
@@ -244,7 +244,7 @@
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 *) AcquireMagickMemory(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/heic.c b/coders/heic.c
index 318183a..5627331 100644
--- a/coders/heic.c
+++ b/coders/heic.c
@@ -153,7 +153,7 @@
if ((MagickSizeType) length > GetBlobSize(image))
ThrowBinaryException(CorruptImageError,"InsufficientImageDataInFile",
image->filename);
- color_buffer=(unsigned char *) AcquireMagickMemory(length);
+ color_buffer=(unsigned char *) AcquireQuantumMemory(1,length);
if (color_buffer != (unsigned char *) NULL)
{
struct heif_error
@@ -206,7 +206,7 @@
if ((MagickSizeType) exif_size > GetBlobSize(image))
ThrowBinaryException(CorruptImageError,"InsufficientImageDataInFile",
image->filename);
- exif_buffer=(unsigned char *) AcquireMagickMemory(exif_size);
+ exif_buffer=(unsigned char *) AcquireQuantumMemory(1,exif_size);
if (exif_buffer != (unsigned char *) NULL)
{
struct heif_error
diff --git a/coders/jp2.c b/coders/jp2.c
index 3dee8d9..577e37b 100644
--- a/coders/jp2.c
+++ b/coders/jp2.c
@@ -859,7 +859,7 @@
/*
Initialize JPEG 2000 API.
*/
- parameters=(opj_cparameters_t *) AcquireMagickMemory(sizeof(*parameters));
+ parameters=(opj_cparameters_t *) AcquireQuantumMemory(1,sizeof(*parameters));
if (parameters == (opj_cparameters_t *) NULL)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
opj_set_default_encoder_parameters(parameters);
diff --git a/coders/json.c b/coders/json.c
index d61c3d3..6ff81e0 100644
--- a/coders/json.c
+++ b/coders/json.c
@@ -787,7 +787,7 @@
sizeof(*values));
if (values == (IPTCInfo **) NULL)
break;
- value=(IPTCInfo *) AcquireMagickMemory(sizeof(*value));
+ value=(IPTCInfo *) AcquireQuantumMemory(1,sizeof(*value));
if (value == (IPTCInfo *) NULL)
break;
/* Check the tag length in IPTCInfo when a new tag is added */
diff --git a/coders/jxl.c b/coders/jxl.c
index fb0a6cb..1f441e7 100644
--- a/coders/jxl.c
+++ b/coders/jxl.c
@@ -110,7 +110,8 @@
static size_t AllocOutput(void* data, const uint8_t* buf, size_t count)
{
OutBuffer *buffer=(OutBuffer *) data;
- buffer->data=ResizeMagickMemory(buffer->data,buffer->size+count);
+ buffer->data=ResizeQuantumMemory(buffer->data,buffer->size+count,
+ sizeof(*buffer->data));
if (!buffer->data) return 0;
memcpy(buffer->data+buffer->size, buf, count);
buffer->size+=count;
@@ -143,7 +144,7 @@
if (status == MagickTrue)
{
jxlsize=(size_t) GetBlobSize(temp_image);
- jxl=(unsigned char *) AcquireMagickMemory(jxlsize);
+ jxl=(unsigned char *) AcquireQuantumMemory(1,jxlsize);
size_t num_read=ReadBlob(temp_image,jxlsize,jxl);
if (num_read != jxlsize) status=MagickFalse;
}
diff --git a/coders/msl.c b/coders/msl.c
index 9b46832..698ee5c 100644
--- a/coders/msl.c
+++ b/coders/msl.c
@@ -7847,15 +7847,15 @@
*/
(void) memset(&msl_info,0,sizeof(msl_info));
msl_info.exception=exception;
- msl_info.image_info=(ImageInfo **) AcquireMagickMemory(
+ msl_info.image_info=(ImageInfo **) AcquireQuantumMemory(1,
sizeof(*msl_info.image_info));
- msl_info.draw_info=(DrawInfo **) AcquireMagickMemory(
+ msl_info.draw_info=(DrawInfo **) AcquireQuantumMemory(1,
sizeof(*msl_info.draw_info));
/* top of the stack is the MSL file itself */
- msl_info.image=(Image **) AcquireMagickMemory(sizeof(*msl_info.image));
- msl_info.attributes=(Image **) AcquireMagickMemory(
+ msl_info.image=(Image **) AcquireQuantumMemory(1,sizeof(*msl_info.image));
+ msl_info.attributes=(Image **) AcquireQuantumMemory(1,
sizeof(*msl_info.attributes));
- msl_info.group_info=(MSLGroupInfo *) AcquireMagickMemory(
+ msl_info.group_info=(MSLGroupInfo *) AcquireQuantumMemory(1,
sizeof(*msl_info.group_info));
if ((msl_info.image_info == (ImageInfo **) NULL) ||
(msl_info.draw_info == (DrawInfo **) NULL) ||
diff --git a/coders/mvg.c b/coders/mvg.c
index cfa684b..3e7db10 100644
--- a/coders/mvg.c
+++ b/coders/mvg.c
@@ -217,7 +217,7 @@
length=GetBlobSize(image);
if (length == (MagickSizeType) ((size_t) length))
{
- draw_info->primitive=(char *) AcquireMagickMemory((size_t) length+1);
+ draw_info->primitive=(char *) AcquireQuantumMemory(1,(size_t) length+1);
if (draw_info->primitive != (char *) NULL)
{
memcpy(draw_info->primitive,GetBlobStreamData(image),(size_t)
diff --git a/coders/png.c b/coders/png.c
index d825574..ae5b747 100644
--- a/coders/png.c
+++ b/coders/png.c
@@ -1757,7 +1757,7 @@
#endif
{
(void) png_ptr;
- return((png_voidp) AcquireMagickMemory((size_t) size));
+ return((png_voidp) AcquireQuantumMemory(1,(size_t) size));
}
/*
@@ -4295,7 +4295,7 @@
/*
Allocate a MngInfo structure.
*/
- mng_info=(MngInfo *) AcquireMagickMemory(sizeof(MngInfo));
+ mng_info=(MngInfo *) AcquireQuantumMemory(1,sizeof(MngInfo));
if (mng_info == (MngInfo *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
@@ -5268,7 +5268,7 @@
/* Allocate a MngInfo structure. */
- mng_info=(MngInfo *) AcquireMagickMemory(sizeof(*mng_info));
+ mng_info=(MngInfo *) AcquireQuantumMemory(1,sizeof(*mng_info));
if (mng_info == (MngInfo *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
@@ -7771,7 +7771,7 @@
/* Allocate a MngInfo structure. */
- mng_info=(MngInfo *) AcquireMagickMemory(sizeof(MngInfo));
+ mng_info=(MngInfo *) AcquireQuantumMemory(1,sizeof(MngInfo));
if (mng_info == (MngInfo *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
@@ -12100,7 +12100,7 @@
/*
Allocate a MngInfo structure.
*/
- mng_info=(MngInfo *) AcquireMagickMemory(sizeof(MngInfo));
+ mng_info=(MngInfo *) AcquireQuantumMemory(1,sizeof(MngInfo));
if (mng_info == (MngInfo *) NULL)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
@@ -13384,7 +13384,7 @@
/*
Allocate a MngInfo structure.
*/
- mng_info=(MngInfo *) AcquireMagickMemory(sizeof(MngInfo));
+ mng_info=(MngInfo *) AcquireQuantumMemory(1,sizeof(MngInfo));
if (mng_info == (MngInfo *) NULL)
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
/*
@@ -13475,7 +13475,7 @@
/*
Allocate a MngInfo structure.
*/
- mng_info=(MngInfo *) AcquireMagickMemory(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 3b3fa24..a609294 100644
--- a/coders/svg.c
+++ b/coders/svg.c
@@ -361,7 +361,7 @@
SVGInfo
*svg_info;
- svg_info=(SVGInfo *) AcquireMagickMemory(sizeof(*svg_info));
+ svg_info=(SVGInfo *) AcquireQuantumMemory(1,sizeof(*svg_info));
if (svg_info == (SVGInfo *) NULL)
return((SVGInfo *) NULL);
(void) memset(svg_info,0,sizeof(*svg_info));
diff --git a/coders/tim2.c b/coders/tim2.c
index 84decc5..64a7bf7 100644
--- a/coders/tim2.c
+++ b/coders/tim2.c
@@ -277,7 +277,7 @@
*/
bits_per_line=image->columns*bits_per_pixel;
bytes_per_line=bits_per_line/8 + ((bits_per_line%8==0) ? 0 : 1);
- row_data=(unsigned char*) AcquireMagickMemory(bytes_per_line);
+ row_data=(unsigned char*) AcquireQuantumMemory(1,bytes_per_line);
if (row_data == (unsigned char *) NULL)
ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
image_info->filename);
@@ -520,7 +520,7 @@
/*
* ### Read CLUT Data ###
*/
- clut_data=(unsigned char *) AcquireMagickMemory(header->clut_size);
+ clut_data=(unsigned char *) AcquireQuantumMemory(1,header->clut_size);
if (clut_data == (unsigned char *) NULL)
ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
image_info->filename);
diff --git a/coders/vid.c b/coders/vid.c
index cab4dc2..853a94e 100644
--- a/coders/vid.c
+++ b/coders/vid.c
@@ -140,7 +140,7 @@
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickCoreSignature);
image=AcquireImage(image_info,exception);
- list=(char **) AcquireMagickMemory(sizeof(*filelist));
+ list=(char **) AcquireQuantumMemory(1,sizeof(*filelist));
if (list == (char **) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
list[0]=ConstantString(image_info->filename);
diff --git a/coders/xwd.c b/coders/xwd.c
index fbb297e..11eaaa7 100644
--- a/coders/xwd.c
+++ b/coders/xwd.c
@@ -335,7 +335,7 @@
/*
Initialize the X image.
*/
- ximage=(XImage *) AcquireMagickMemory(sizeof(*ximage));
+ ximage=(XImage *) AcquireQuantumMemory(1,sizeof(*ximage));
if (ximage == (XImage *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
ximage->depth=(int) header.pixmap_depth;