File ImageMagick-CVE-2019-7398.patch of Package ImageMagick.19146

diff --git a/coders/dib.c b/coders/dib.c
index 5208e8d6ea..72578f108a 100644
--- a/coders/dib.c
+++ b/coders/dib.c
@@ -1377,7 +1377,10 @@ static MagickBooleanType WriteDIBImage(const ImageInfo *image_info,Image *image,
           dib_colormap=(unsigned char *) AcquireQuantumMemory((size_t)
             (1UL << dib_info.bits_per_pixel),4*sizeof(*dib_colormap));
           if (dib_colormap == (unsigned char *) NULL)
-            ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
+            {
+              pixels=(unsigned char *) RelinquishMagickMemory(pixels);
+              ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
+            }
           q=dib_colormap;
           for (i=0; i < (ssize_t) MagickMin(image->colors,dib_info.number_colors); i++)
           {

openSUSE Build Service is sponsored by