Skip to content

Commit bd40cc5

Browse files
author
Cristy
committed
https://github.com/ImageMagick/ImageMagick/issues/576
1 parent 2ba8f33 commit bd40cc5

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Diff for: coders/pdf.c

+10-3
Original file line numberDiff line numberDiff line change
@@ -1989,7 +1989,11 @@ RestoreMSCWarning
19891989
length*=image->colorspace == CMYKColorspace ? 4UL : 3UL;
19901990
pixel_info=AcquireVirtualMemory(length,sizeof(*pixels));
19911991
if (pixel_info == (MemoryInfo *) NULL)
1992-
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
1992+
{
1993+
xref=(MagickOffsetType *) RelinquishMagickMemory(xref);
1994+
ThrowWriterException(ResourceLimitError,
1995+
"MemoryAllocationFailed");
1996+
}
19931997
pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);
19941998
/*
19951999
Dump runoffset encoded pixels.
@@ -2086,8 +2090,11 @@ RestoreMSCWarning
20862090
length=(size_t) number_pixels;
20872091
pixel_info=AcquireVirtualMemory(length,sizeof(*pixels));
20882092
if (pixel_info == (MemoryInfo *) NULL)
2089-
ThrowWriterException(ResourceLimitError,
2090-
"MemoryAllocationFailed");
2093+
{
2094+
xref=(MagickOffsetType *) RelinquishMagickMemory(xref);
2095+
ThrowWriterException(ResourceLimitError,
2096+
"MemoryAllocationFailed");
2097+
}
20912098
pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);
20922099
/*
20932100
Dump Runlength encoded pixels.

0 commit comments

Comments
 (0)