 #if os(iOS) || os(macOS)
 import CoreGraphics
 
-private func webp_freeWebPData(info: UnsafeMutableRawPointer?, data: UnsafeRawPointer, size: Int) -> Void {
-    if let info = info {
-        var config = info.assumingMemoryBound(to: CWebP.WebPDecoderConfig.self).pointee
-        WebPFreeDecBuffer(&config.output)
-    }
-    free(UnsafeMutableRawPointer(mutating: data))
+private func releaseData(info: UnsafeMutableRawPointer?, data: UnsafeRawPointer, size: Int) -> Void {
+    // core foundation objects are managed by ARC so don't need to do anything here
 }
 
 // WebPSimple class is temporary implementation until v0.1"

        let provider = CGDataProvider(dataInfo: &config,
                                      data: config.output.u.RGBA.rgba,
                                      size: (Int(config.input.width) * Int(config.input.height) * 4),
                                      releaseData: webp_freeWebPData)!
        let cgImage = CGImage(
            width: Int(config.input.width),
            height: Int(config.input.height),

            decode: nil,
            shouldInterpolate: false,
            intent: CGColorRenderingIntent.defaultIntent)!
        WebPFreeDecBuffer(&config.output)
        return cgImage
    }
}
