Skip to content

Commit 306c1f0

Browse files
author
Cristy
committed
https://github.com/ImageMagick/ImageMagick/issues/1454
1 parent d8bcdf1 commit 306c1f0

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

Diff for: coders/pdf.c

+17-9
Original file line numberDiff line numberDiff line change
@@ -1901,6 +1901,7 @@ RestoreMSCWarning
19011901
status=InjectImageBlob(image_info,image,image,"jpeg",exception);
19021902
if (status == MagickFalse)
19031903
{
1904+
xref=(MagickOffsetType *) RelinquishMagickMemory(xref);
19041905
(void) CloseBlob(image);
19051906
return(MagickFalse);
19061907
}
@@ -1911,6 +1912,7 @@ RestoreMSCWarning
19111912
status=InjectImageBlob(image_info,image,image,"jp2",exception);
19121913
if (status == MagickFalse)
19131914
{
1915+
xref=(MagickOffsetType *) RelinquishMagickMemory(xref);
19141916
(void) CloseBlob(image);
19151917
return(MagickFalse);
19161918
}
@@ -1964,6 +1966,7 @@ RestoreMSCWarning
19641966
pixel_info=RelinquishVirtualMemory(pixel_info);
19651967
if (status == MagickFalse)
19661968
{
1969+
xref=(MagickOffsetType *) RelinquishMagickMemory(xref);
19671970
(void) CloseBlob(image);
19681971
return(MagickFalse);
19691972
}
@@ -2010,6 +2013,7 @@ RestoreMSCWarning
20102013
status=InjectImageBlob(image_info,image,image,"jpeg",exception);
20112014
if (status == MagickFalse)
20122015
{
2016+
xref=(MagickOffsetType *) RelinquishMagickMemory(xref);
20132017
(void) CloseBlob(image);
20142018
return(MagickFalse);
20152019
}
@@ -2020,6 +2024,7 @@ RestoreMSCWarning
20202024
status=InjectImageBlob(image_info,image,image,"jp2",exception);
20212025
if (status == MagickFalse)
20222026
{
2027+
xref=(MagickOffsetType *) RelinquishMagickMemory(xref);
20232028
(void) CloseBlob(image);
20242029
return(MagickFalse);
20252030
}
@@ -2038,10 +2043,7 @@ RestoreMSCWarning
20382043
length*=image->colorspace == CMYKColorspace ? 4UL : 3UL;
20392044
pixel_info=AcquireVirtualMemory(length,sizeof(*pixels));
20402045
if (pixel_info == (MemoryInfo *) NULL)
2041-
{
2042-
xref=(MagickOffsetType *) RelinquishMagickMemory(xref);
2043-
ThrowPDFException(ResourceLimitError,"MemoryAllocationFailed");
2044-
}
2046+
ThrowPDFException(ResourceLimitError,"MemoryAllocationFailed");
20452047
pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);
20462048
/*
20472049
Dump runoffset encoded pixels.
@@ -2081,6 +2083,7 @@ RestoreMSCWarning
20812083
pixel_info=RelinquishVirtualMemory(pixel_info);
20822084
if (status == MagickFalse)
20832085
{
2086+
xref=(MagickOffsetType *) RelinquishMagickMemory(xref);
20842087
(void) CloseBlob(image);
20852088
return(MagickFalse);
20862089
}
@@ -2138,11 +2141,7 @@ RestoreMSCWarning
21382141
length=(size_t) number_pixels;
21392142
pixel_info=AcquireVirtualMemory(length,sizeof(*pixels));
21402143
if (pixel_info == (MemoryInfo *) NULL)
2141-
{
2142-
xref=(MagickOffsetType *) RelinquishMagickMemory(xref);
2143-
ThrowPDFException(ResourceLimitError,
2144-
"MemoryAllocationFailed");
2145-
}
2144+
ThrowPDFException(ResourceLimitError,"MemoryAllocationFailed");
21462145
pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);
21472146
/*
21482147
Dump Runlength encoded pixels.
@@ -2178,6 +2177,7 @@ RestoreMSCWarning
21782177
pixel_info=RelinquishVirtualMemory(pixel_info);
21792178
if (status == MagickFalse)
21802179
{
2180+
xref=(MagickOffsetType *) RelinquishMagickMemory(xref);
21812181
(void) CloseBlob(image);
21822182
return(MagickFalse);
21832183
}
@@ -2426,6 +2426,7 @@ RestoreMSCWarning
24262426
exception);
24272427
if (status == MagickFalse)
24282428
{
2429+
xref=(MagickOffsetType *) RelinquishMagickMemory(xref);
24292430
(void) CloseBlob(image);
24302431
return(MagickFalse);
24312432
}
@@ -2436,6 +2437,7 @@ RestoreMSCWarning
24362437
status=InjectImageBlob(image_info,image,tile_image,"jp2",exception);
24372438
if (status == MagickFalse)
24382439
{
2440+
xref=(MagickOffsetType *) RelinquishMagickMemory(xref);
24392441
(void) CloseBlob(image);
24402442
return(MagickFalse);
24412443
}
@@ -2487,6 +2489,7 @@ RestoreMSCWarning
24872489
pixel_info=RelinquishVirtualMemory(pixel_info);
24882490
if (status == MagickFalse)
24892491
{
2492+
xref=(MagickOffsetType *) RelinquishMagickMemory(xref);
24902493
(void) CloseBlob(image);
24912494
return(MagickFalse);
24922495
}
@@ -2528,6 +2531,7 @@ RestoreMSCWarning
25282531
exception);
25292532
if (status == MagickFalse)
25302533
{
2534+
xref=(MagickOffsetType *) RelinquishMagickMemory(xref);
25312535
(void) CloseBlob(image);
25322536
return(MagickFalse);
25332537
}
@@ -2538,6 +2542,7 @@ RestoreMSCWarning
25382542
status=InjectImageBlob(image_info,image,tile_image,"jp2",exception);
25392543
if (status == MagickFalse)
25402544
{
2545+
xref=(MagickOffsetType *) RelinquishMagickMemory(xref);
25412546
(void) CloseBlob(image);
25422547
return(MagickFalse);
25432548
}
@@ -2593,6 +2598,7 @@ RestoreMSCWarning
25932598
pixel_info=RelinquishVirtualMemory(pixel_info);
25942599
if (status == MagickFalse)
25952600
{
2601+
xref=(MagickOffsetType *) RelinquishMagickMemory(xref);
25962602
(void) CloseBlob(image);
25972603
return(MagickFalse);
25982604
}
@@ -2681,6 +2687,7 @@ RestoreMSCWarning
26812687
pixel_info=RelinquishVirtualMemory(pixel_info);
26822688
if (status == MagickFalse)
26832689
{
2690+
xref=(MagickOffsetType *) RelinquishMagickMemory(xref);
26842691
(void) CloseBlob(image);
26852692
return(MagickFalse);
26862693
}
@@ -2893,6 +2900,7 @@ RestoreMSCWarning
28932900
pixel_info=RelinquishVirtualMemory(pixel_info);
28942901
if (status == MagickFalse)
28952902
{
2903+
xref=(MagickOffsetType *) RelinquishMagickMemory(xref);
28962904
(void) CloseBlob(image);
28972905
return(MagickFalse);
28982906
}

0 commit comments

Comments
 (0)