From b6e57af3d2316d6e6aacd80cbcf212051af9c29b Mon Sep 17 00:00:00 2001 From: Serhii Suprun Date: Wed, 19 Dec 2018 19:14:07 +0200 Subject: [PATCH] Fixed leaked buffer --- Sources/PerfectCrypto/Extensions.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/PerfectCrypto/Extensions.swift b/Sources/PerfectCrypto/Extensions.swift index 552fc1e..5e005ab 100644 --- a/Sources/PerfectCrypto/Extensions.swift +++ b/Sources/PerfectCrypto/Extensions.swift @@ -69,8 +69,8 @@ public extension File { try chain.flush() let validLength = digest.length let ret = UnsafeMutableRawBufferPointer.allocate(byteCount: validLength, alignment: 0) + defer { ret.deallocate() } guard try filter.get(ret) == validLength else { - ret.deallocate() return [] } return ret.map { $0 }