Skip to content

Commit 4325b64

Browse files
authored
Merge pull request #2 from marselester/fix-stack-alloc
Fix dangling pointer in `ipToBytes`
2 parents d1be2b7 + 04ae7dc commit 4325b64

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/net.zig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ pub const IP = union(enum) {
7878
pub fn ipToBytes(address: *const std.net.Address) []const u8 {
7979
return switch (address.any.family) {
8080
std.posix.AF.INET => {
81-
const b = std.mem.asBytes(&address.in.sa.addr).*;
82-
return &b;
81+
return std.mem.asBytes(&address.in.sa.addr);
8382
},
8483
std.posix.AF.INET6 => &address.in6.sa.addr,
8584
else => unreachable,

0 commit comments

Comments
 (0)