std.net.getAddressList: fix segfault on bad hostname

Fixes #12065
This commit is contained in:
Veikka Touminen 2022-07-10 04:27:23 -06:00 committed by Veikka Tuominen
parent 889efddd1a
commit 819c868bbf

View File

@ -731,7 +731,7 @@ pub fn getAddressList(allocator: mem.Allocator, name: []const u8, port: u16) !*A
break :blk result;
};
const arena = result.arena.allocator();
errdefer result.arena.deinit();
errdefer result.deinit();
if (builtin.target.os.tag == .windows or builtin.link_libc) {
const name_c = try std.cstr.addNullByte(allocator, name);