From 13cd88512cb4024e5b225c6e26c0882c98cc38d2 Mon Sep 17 00:00:00 2001 From: Grzegorz Em <11218364+kodelit@users.noreply.github.com> Date: Fri, 21 Dec 2018 15:11:17 +0100 Subject: [PATCH] Memory Leak Fix --- SwiftGifCommon/UIImage+Gif.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/SwiftGifCommon/UIImage+Gif.swift b/SwiftGifCommon/UIImage+Gif.swift index 5f0b99e..082a90a 100644 --- a/SwiftGifCommon/UIImage+Gif.swift +++ b/SwiftGifCommon/UIImage+Gif.swift @@ -94,6 +94,9 @@ extension UIImage { // Get dictionaries let cfProperties = CGImageSourceCopyPropertiesAtIndex(source, index, nil) let gifPropertiesPointer = UnsafeMutablePointer.allocate(capacity: 0) + defer { + gifPropertiesPointer.deallocate() + } if CFDictionaryGetValueIfPresent(cfProperties, Unmanaged.passUnretained(kCGImagePropertyGIFDictionary).toOpaque(), gifPropertiesPointer) == false { return delay }