diff --git a/src/ImageSharp/Formats/AnimationUtilities.cs b/src/ImageSharp/Formats/AnimationUtilities.cs index 3c731422ad..727364227e 100644 --- a/src/ImageSharp/Formats/AnimationUtilities.cs +++ b/src/ImageSharp/Formats/AnimationUtilities.cs @@ -43,7 +43,7 @@ internal static class AnimationUtilities where TPixel : unmanaged, IPixel { MemoryAllocator memoryAllocator = configuration.MemoryAllocator; - IMemoryOwner buffers = memoryAllocator.Allocate(currentFrame.Width * 4, AllocationOptions.Clean); + using IMemoryOwner buffers = memoryAllocator.Allocate(currentFrame.Width * 4, AllocationOptions.Clean); Span previous = buffers.GetSpan()[..currentFrame.Width]; Span current = buffers.GetSpan().Slice(currentFrame.Width, currentFrame.Width); Span next = buffers.GetSpan().Slice(currentFrame.Width * 2, currentFrame.Width);