Browse Source

Free the alloc memory

onevcat 1 year ago
parent
commit
2239ba5c41
1 changed files with 1 additions and 0 deletions
  1. 1 0
      Sources/Image/ImageDrawing.swift

+ 1 - 0
Sources/Image/ImageDrawing.swift

@@ -344,6 +344,7 @@ extension KingfisherWrapper where Base: KFCrossPlatformImage {
         var inBuffer = vImage_Buffer(data: inData, height: height, width: width, rowBytes: rowBytes)
 
         let outData = malloc(cgImage.bytesPerRow * cgImage.height)
+        defer { free(outData) }
         var outBuffer = vImage_Buffer(data: outData, height: height, width: width, rowBytes: rowBytes)
         
         for _ in 0 ..< iterations {