Commit 06f5b608b for imagemagick.org

commit 06f5b608b5b331f22be171bb988130b81a68c85a
Author: Cristy <urban-warrior@imagemagick.org>
Date:   Sun Oct 18 09:37:18 2026 -0400

    https://github.com/ImageMagick/ImageMagick/issues/9040

diff --git a/MagickCore/matrix.c b/MagickCore/matrix.c
index 077ff0f2d..eb285dca3 100644
--- a/MagickCore/matrix.c
+++ b/MagickCore/matrix.c
@@ -221,7 +221,7 @@ MagickExport MatrixInfo *AcquireMatrixInfo(const size_t columns,
         "CacheResourcesExhausted","`%s'","matrix cache");
       return(DestroyMatrixInfo(matrix_info));
     }
-  matrix_info->type=MemoryCache;
+  matrix_info->type=UndefinedCache;
   status=AcquireMagickResource(AreaResource,matrix_info->length);
   if ((status != MagickFalse) &&
       (matrix_info->length == (MagickSizeType) ((size_t) matrix_info->length)) &&
@@ -241,6 +241,8 @@ MagickExport MatrixInfo *AcquireMatrixInfo(const size_t columns,
             }
           if (matrix_info->elements == (unsigned short *) NULL)
             RelinquishMagickResource(MemoryResource,matrix_info->length);
+          else
+            matrix_info->type=MemoryCache;
         }
     }
   matrix_info->file=(-1);