Update dns_resolver.zig

This commit is contained in:
Jarred Sumner
2023-09-01 02:23:54 -07:00
parent f8e99eae9b
commit 53eb338048

View File

@@ -1370,8 +1370,12 @@ pub const DNSResolver = struct {
var pending: ?*CAresLookup(cares_type, lookup_name) = key.lookup.head.next;
var prev_global = key.lookup.head.globalThis;
// The callback need not and should not attempt to free the memory
// pointed to by hostent; the ares library will free it when the
// callback returns.
var array = addr.toJSReponse(this.vm.allocator, prev_global, lookup_name);
defer addr.deinit();
array.ensureStillAlive();
key.lookup.head.onComplete(array);
bun.default_allocator.destroy(key.lookup);