File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
Sources/AsyncDNSResolver/c-ares Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -160,8 +160,12 @@ class Ares {
160
160
preconditionFailure ( " 'arg' is nil. This is a bug. " )
161
161
}
162
162
163
- let handler = QueryReplyHandler ( pointer: handlerPointer)
164
- defer { handlerPointer. deallocate ( ) }
163
+ let pointer = handlerPointer. assumingMemoryBound ( to: QueryReplyHandler . self)
164
+ let handler = pointer. pointee
165
+ defer {
166
+ pointer. deinitialize ( count: 1 )
167
+ pointer. deallocate ( )
168
+ }
165
169
166
170
handler. handle ( status: status, buffer: buf, length: len)
167
171
}
@@ -276,11 +280,6 @@ extension Ares {
276
280
}
277
281
}
278
282
279
- init ( pointer: UnsafeMutableRawPointer ) {
280
- let handlerPointer = pointer. assumingMemoryBound ( to: Self . self)
281
- self = handlerPointer. pointee
282
- }
283
-
284
283
func handle( status: CInt , buffer: UnsafeMutablePointer < CUnsignedChar > ? , length: CInt ) {
285
284
self . _handler ( status, buffer, length)
286
285
}
You can’t perform that action at this time.
0 commit comments