Commit fd1b9c85f for imagemagick.org

commit fd1b9c85f2634e34034d39016ed7542ac0a19930
Author: Cristy <urban-warrior@imagemagick.org>
Date:   Tue Sep 22 07:16:14 2026 -0400

    https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-hvwf-wmm6-hvc3

diff --git a/coders/png.c b/coders/png.c
index 6b08c5fed..93b928865 100644
--- a/coders/png.c
+++ b/coders/png.c
@@ -9401,12 +9401,18 @@ static MagickBooleanType WriteOnePNGImage(MngWriteInfo *mng_info,

 #endif
   if (ping == (png_struct *) NULL)
-    ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
+    {
+      image_info=DestroyImageInfo(image_info);
+      image=DestroyImage(image);
+      ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
+    }

   ping_info=png_create_info_struct(ping);

   if (ping_info == (png_info *) NULL)
     {
+      image_info=DestroyImageInfo(image_info);
+      image=DestroyImage(image);
       png_destroy_write_struct(&ping,(png_info **) NULL);
       ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
     }