| ... | @@ -764,7 +764,7 @@ pub fn getAddressList(allocator: mem.Allocator, name: []const u8, port: u16) !*A | ... | @@ -764,7 +764,7 @@ pub fn getAddressList(allocator: mem.Allocator, name: []const u8, port: u16) !*A |
| 764 | .addrlen = 0, | 764 | .addrlen = 0, |
| 765 | .next = null, | 765 | .next = null, |
| 766 | }; | 766 | }; |
| 767 | var res: *os.addrinfo = undefined; | 767 | var res: ?*os.addrinfo = null; |
| 768 | var first = true; | 768 | var first = true; |
| 769 | while (true) { | 769 | while (true) { |
| 770 | const rc = ws2_32.getaddrinfo(name_c.ptr, port_c.ptr, &hints, &res); | 770 | const rc = ws2_32.getaddrinfo(name_c.ptr, port_c.ptr, &hints, &res); |
| ... | @@ -791,7 +791,7 @@ pub fn getAddressList(allocator: mem.Allocator, name: []const u8, port: u16) !*A | ... | @@ -791,7 +791,7 @@ pub fn getAddressList(allocator: mem.Allocator, name: []const u8, port: u16) !*A |
| 791 | | 791 | |
| 792 | const addr_count = blk: { | 792 | const addr_count = blk: { |
| 793 | var count: usize = 0; | 793 | var count: usize = 0; |
| 794 | var it: ?*os.addrinfo = res; | 794 | var it = res; |
| 795 | while (it) |info| : (it = info.next) { | 795 | while (it) |info| : (it = info.next) { |
| 796 | if (info.addr != null) { | 796 | if (info.addr != null) { |
| 797 | count += 1; | 797 | count += 1; |
| ... | @@ -801,7 +801,7 @@ pub fn getAddressList(allocator: mem.Allocator, name: []const u8, port: u16) !*A | ... | @@ -801,7 +801,7 @@ pub fn getAddressList(allocator: mem.Allocator, name: []const u8, port: u16) !*A |
| 801 | }; | 801 | }; |
| 802 | result.addrs = try arena.alloc(Address, addr_count); | 802 | result.addrs = try arena.alloc(Address, addr_count); |
| 803 | | 803 | |
| 804 | var it: ?*os.addrinfo = res; | 804 | var it = res; |
| 805 | var i: usize = 0; | 805 | var i: usize = 0; |
| 806 | while (it) |info| : (it = info.next) { | 806 | while (it) |info| : (it = info.next) { |
| 807 | const addr = info.addr orelse continue; | 807 | const addr = info.addr orelse continue; |
| ... | @@ -836,7 +836,7 @@ pub fn getAddressList(allocator: mem.Allocator, name: []const u8, port: u16) !*A | ... | @@ -836,7 +836,7 @@ pub fn getAddressList(allocator: mem.Allocator, name: []const u8, port: u16) !*A |
| 836 | .addrlen = 0, | 836 | .addrlen = 0, |
| 837 | .next = null, | 837 | .next = null, |
| 838 | }; | 838 | }; |
| 839 | var res: *os.addrinfo = undefined; | 839 | var res: ?*os.addrinfo = null; |
| 840 | switch (sys.getaddrinfo(name_c.ptr, port_c.ptr, &hints, &res)) { | 840 | switch (sys.getaddrinfo(name_c.ptr, port_c.ptr, &hints, &res)) { |
| 841 | @intToEnum(sys.EAI, 0) => {}, | 841 | @intToEnum(sys.EAI, 0) => {}, |
| 842 | .ADDRFAMILY => return error.HostLacksNetworkAddresses, | 842 | .ADDRFAMILY => return error.HostLacksNetworkAddresses, |
| ... | @@ -854,11 +854,11 @@ pub fn getAddressList(allocator: mem.Allocator, name: []const u8, port: u16) !*A | ... | @@ -854,11 +854,11 @@ pub fn getAddressList(allocator: mem.Allocator, name: []const u8, port: u16) !*A |
| 854 | }, | 854 | }, |
| 855 | else => unreachable, | 855 | else => unreachable, |
| 856 | } | 856 | } |
| 857 | defer sys.freeaddrinfo(res); | 857 | defer if (res) |some| sys.freeaddrinfo(some); |
| 858 | | 858 | |
| 859 | const addr_count = blk: { | 859 | const addr_count = blk: { |
| 860 | var count: usize = 0; | 860 | var count: usize = 0; |
| 861 | var it: ?*os.addrinfo = res; | 861 | var it = res; |
| 862 | while (it) |info| : (it = info.next) { | 862 | while (it) |info| : (it = info.next) { |
| 863 | if (info.addr != null) { | 863 | if (info.addr != null) { |
| 864 | count += 1; | 864 | count += 1; |
| ... | @@ -868,7 +868,7 @@ pub fn getAddressList(allocator: mem.Allocator, name: []const u8, port: u16) !*A | ... | @@ -868,7 +868,7 @@ pub fn getAddressList(allocator: mem.Allocator, name: []const u8, port: u16) !*A |
| 868 | }; | 868 | }; |
| 869 | result.addrs = try arena.alloc(Address, addr_count); | 869 | result.addrs = try arena.alloc(Address, addr_count); |
| 870 | | 870 | |
| 871 | var it: ?*os.addrinfo = res; | 871 | var it = res; |
| 872 | var i: usize = 0; | 872 | var i: usize = 0; |
| 873 | while (it) |info| : (it = info.next) { | 873 | while (it) |info| : (it = info.next) { |
| 874 | const addr = info.addr orelse continue; | 874 | const addr = info.addr orelse continue; |