@@ -303,12 +303,6 @@ extension Ares {
303
303
static let instance = AQueryReplyParser ( )
304
304
305
305
func parse( buffer: UnsafeMutablePointer < CUnsignedChar > ? , length: CInt ) throws -> [ ARecord ] {
306
- // `hostent` is not needed, but if we don't allocate and pass it as an arg c-ares will allocate one
307
- // and free it automatically, and that might cause TSAN errors in `ares_free_hostent`. If we allocate
308
- // it then we control when it's freed.
309
- let hostentPtrPtr = UnsafeMutablePointer< UnsafeMutablePointer< hostent>?> . allocate( capacity: 1 )
310
- defer { hostentPtrPtr. deallocate ( ) }
311
-
312
306
let addrttlsPointer = UnsafeMutablePointer< ares_addrttl> . allocate( capacity: Ares . maxAddresses)
313
307
defer { addrttlsPointer. deallocate ( ) }
314
308
let naddrttlsPointer = UnsafeMutablePointer< CInt> . allocate( capacity: 1 )
@@ -317,7 +311,7 @@ extension Ares {
317
311
// Set a limit or else addrttl array won't be populated
318
312
naddrttlsPointer. pointee = CInt ( Ares . maxAddresses)
319
313
320
- let parseStatus = ares_parse_a_reply ( buffer, length, hostentPtrPtr , addrttlsPointer, naddrttlsPointer)
314
+ let parseStatus = ares_parse_a_reply ( buffer, length, nil , addrttlsPointer, naddrttlsPointer)
321
315
guard parseStatus == ARES_SUCCESS else {
322
316
throw AsyncDNSResolver . Error ( code: parseStatus, " failed to parse A query reply " )
323
317
}
@@ -332,12 +326,6 @@ extension Ares {
332
326
static let instance = AAAAQueryReplyParser ( )
333
327
334
328
func parse( buffer: UnsafeMutablePointer < CUnsignedChar > ? , length: CInt ) throws -> [ AAAARecord ] {
335
- // `hostent` is not needed, but if we don't allocate and pass it as an arg c-ares will allocate one
336
- // and free it automatically, and that might cause TSAN errors in `ares_free_hostent`. If we allocate
337
- // it then we control when it's freed.
338
- let hostentPtrPtr = UnsafeMutablePointer< UnsafeMutablePointer< hostent>?> . allocate( capacity: 1 )
339
- defer { hostentPtrPtr. deallocate ( ) }
340
-
341
329
let addrttlsPointer = UnsafeMutablePointer< ares_addr6ttl> . allocate( capacity: Ares . maxAddresses)
342
330
defer { addrttlsPointer. deallocate ( ) }
343
331
let naddrttlsPointer = UnsafeMutablePointer< CInt> . allocate( capacity: 1 )
@@ -346,7 +334,7 @@ extension Ares {
346
334
// Set a limit or else addrttl array won't be populated
347
335
naddrttlsPointer. pointee = CInt ( Ares . maxAddresses)
348
336
349
- let parseStatus = ares_parse_aaaa_reply ( buffer, length, hostentPtrPtr , addrttlsPointer, naddrttlsPointer)
337
+ let parseStatus = ares_parse_aaaa_reply ( buffer, length, nil , addrttlsPointer, naddrttlsPointer)
350
338
guard parseStatus == ARES_SUCCESS else {
351
339
throw AsyncDNSResolver . Error ( code: parseStatus, " failed to parse AAAA query reply " )
352
340
}
0 commit comments