 
     public func readByte() throws -> UInt8 {
         let buffer = UnsafeMutablePointer<UInt8>.allocate(capacity: 1)
-        
+
         defer {
-            buffer.deallocate(capacity: 1)
-        }
-        
+            buffer.deallocate()
+        }
+
         while true {
             let bytesRead = try readBytes(into: buffer, size: 1)
-            
+
             if bytesRead > 0 {
                 return buffer[0]
             }

        let size = data.count
        let buffer = UnsafeMutablePointer<UInt8>.allocate(capacity: size)
        defer {
            buffer.deallocate(capacity: size)
        }

        data.copyBytes(to: buffer, count: size)

        var data = Data()
        let buffer = UnsafeMutablePointer<UInt8>.allocate(capacity: 1)
        defer {
            buffer.deallocate()
        }

        while true {
